(navigation image)
Home American Libraries | Canadian Libraries | Universal Library | Community Texts | Project Gutenberg | Biodiversity Heritage Library | Children's Library | Additional Collections
Search: Advanced Search
Anonymous User (login or join us)
Upload
See other formats

Full text of "Apple IIc Reference Manual, The - Volume 2 (1994)(Apple)"

I ^BZ^^I ^" 



The Apple Ik 
Reference Manual 

Volume 2 




Customer Satisfaction 



II you discover physical delects in Ihe manuals distributed with an Apple product or in the 
media on which a software product is distributed. Apple will replace the documentation 
or media at no charge to you during the 90-day period after you purchased the product. 

In addition, il Apple releases a corrective update to a software product during trie 90-day 
period after you purchased the software. Apple will replace the applicable disks and 
documentation with the revised version at no charge to you during the six months after 
the date of purchase 

In some countries the replacement period may be different; check with youi authorized 
Apple dealer Return any item to be replaced with proof of purchase to Apple or an 
authorized Apple dealer. 



Limitation on Warranties 
and Liability 



Even though Apple has tested Ihe software described in the manual and reviewed its 
contents, neither Apple nor lis software suppliers make any warranty or representation 
either express or implied, wilh respect to this manual or to the software described In this 
manual, their quality, performance, merchantability, or fitness for any particular purpose. 
As a result, this software and manual are sold "as is." and vou the purchaser are 
assuming Ihe entire risk as to their quality and performance. In no event will Apple of Us 
soltware suppliers be liable for direct, indirect. Incidental, or consequential damages 
resulting from any delect in the software or manual, even if they have been advised of Ihe 
possibility of such damages in particular, they shall have no liability for any programs or 
data stored in or used wilh Apple products, Including Ihe costs of recovering or 
reproducing these programs or data Some states do not allow the exclusion or limitation 
ot implied warranties or liability for Incidental or consequential damages, so the above 
limitation or exclusion may not apply lo you 



Copyright 



This manual and the software (computer programs) described in it are copyrighted by 
Apple or by Apple's software suppliers, with all rights reserved Under the copyrrghi laws. 
this manual or the programs may not be copied, in whole or part, without the written 
consent of Apple, except in the normal use ol the software or to make a backup copy 
Ttils exception does no! allow copies to be made for others, whether or not sold, but all of 
the material purchased (with all backup copies) may be sold, given, or lent to another 
person. Under the law. copying includes translating into another language 

You may use the software on any computer owned by you. but extra copies cannot be 
made for this purpose For some products, a multi-use license may be purchased to allow 
the software to bo used on more than one computer owned by Ihe purchaser, including a 
shared-disk system. (Contact your authorized Apple dealer tor Information on multi-use 
licenses.) 



Product Revisions 



Apple cannot guarantee thai you will receive notice of a revision to the software 
described in Ihe manual, even it you have returned a registration card received with the 
product. You should periodically check with your authorized Apple dealer 

© Apple Computer, Inc 1984 
20525 Mariam Avenue 
Cupertino. California 950 14 

Apple, the Apple logo, and ProDOS are trademarks ol Apple Computer Inc 

Simultaneously published in the United Stales and Canada. All rights reserved 



Warning 



This equipment has been certified to comply with the limits tor a Class B computing 
device, pursuant lo Subpart J of Part 15 of FCC Rules. Only peripherals (computer 
input/output devices, terminals, printers, etc) certified to comply with the Class B limits 
may be attached to this computer. Operation with non-certified peripherals is likely to 
result in interference to radio and TV reception 



Reorder Apple Product #A2L4030 



u: 

L 



i 

l; 



^pp/e //c Reference Manual 
Volume 2 




h 



l: 



List of Figures and Tables 



IX 



Preface 



■ Appendix A 



iz 



Appendix B 



s 



Appendix C 






XIII 



77?e 65C02 Microprocessor 

2 A.1 Differences Between 6502 and 65C02 

2 A. 1.1 Differing Cycle Times 

3 A.1 .2 Differing Instruction Results 

4 A.2 Data Sheet 



Memory Map 



15 



15 B.1 Page Zero 

19 B.2 Page Three 

20 B.3 Screen Holes 

23 B.4 The Hardware Page 



Important Firmware Locations 

31 C.1 The Tables 

32 C.2 Port Addresses 

34 C.3 Other Video and I/O Firmware Addresses 
34 C.4 Applesoft BASIC Interpreter Addresses 
34 C.5 Monitor Addresses 



Table of Contents 



31 



nr 



Appendix D 



Operating Systems and Languages 

37 D.1 Operating Systems 
37 D.1.1 ProDOS 

37 D. 1.2 DOS 

38 D.1.3 Pascal Operating System 
38 D.1 .4 CP/M 

38 D.2 Languages 

38 D.2.1 Applesoft BASIC 

39 D.2.2 Integer BASIC 
39 D.2.3 Pascal Language 
39 D.2.4 FORTRAN 



37 



Appendix E 



Interrupts 

41 E.1 Introduction 

41 E.1.1 What Is an Interrupt? 

42 E.1 .2 Interrupts on Apple II Computers 

43 E.1 .3 Interrupt Handling on the 65C02 

43 E.1. 4 The Interrupt Vector at SFFFE 

44 E.2 The Built-in Interrupt Handler 

46 E.2.1 Saving the Memory Configuration 

46 E.2. 2 Managing Main and Auxiliary Stacks 

47 E.3 User's Interrupt Handler at S3FE 

48 E.4 Handling Break Instructions 

49 E.5 Sources of Interrupts 

50 E.6 Firmware Handling of Interrupts 
50 E.6.1 Firmware for Mouse and VBL 

52 E.6.2 Firmware for Keyboard Interrupts 

53 Using Keyboard Buffering Firmware 

53 Using Keyboard Interrupts 
Through Software 

54 E.6.3 Using External Interrupts 
Through Firmware 

55 E.6.4 Firmware for Serial Interrupts 

55 Using Serial Buffering Transparently 

56 Using Serial Interrupts Through Firmware 

57 Transmitting Serial Data 

57 A Loophole in the Firmware 

58 E.7 Bypassing the Interrupt Firmware 

58 E.7.1 Using Mouse Interrupts 
Without the Firmware 

59 E.7.2 Using ACIA Interrupts 
Without the Firmware 



41 



£ 

i 



Table of Contents 



L 


[ 1 Appendix F Apple II Series Differences 


61 


■ M 


61 


F.1 Overview 






63 


F.1.1 Type of CPU 




p 


63 


F.1 .2 Machine Identification 




64 


F.2 Memory Structure 






64 


F.2.1 Amount and Address Ranges of RAM 




ta 


65 


F.2.2 Amount and Address Ranges of ROM 




66 


F.2. 3 Peripheral-Card Memory Spaces 






66 


F.2. 4 Hardware Addresses 




t§ 


67 


SC000 to SCOOF 




67 


SC010 to SC01F 






68 


SC020 to SC02F 




p 


68 


$C030 to SC03F 




68 


SC040 to SC04F 






68 


SC050 to SC05F 




p 


69 


SC060 to SC06F 




70 


SC070 to SC07F 






70 


SC080 to SC08F 




p 


70 


SC090 to SCOFF 




71 


F.2. 5 Monitors 






72 


F.3 I/O in General 




ii^^_ 


72 


F.3.1 DMA Transfers 




ki 


72 


F.3.2 Slots Versus Ports 






72 


F.3.3 Interrupts 




k= 


73 


F.4 Keyboard 




f-a 


73 


F.4.1 Keys 






74 


F.4.2 Character Sets 




L 


75 


F.5 Speaker 




■ ^ 


75 


F.6 Video Display 






75 


F.6.1 Character Sets 




k= 


76 


F.6.2 MouseText 




e 


76 


F.6.3 Vertical Blanking 




76 


F.6.4 Display Modes 




77 


F.7 Disk I/O 




» ■-* 


77 


F.8 Serial I/O 




i: 


77 


F.8.1 Serial Ports Versus Serial Cards 




78 


F.8.2 Serial I/O Buffers 




i im 


79 


F.9 Mouse and Hand Controls 






79 


F.9.1 Mouse Input 




t= 


79 


F.9.2 Hand Control Input and Output 




1*3 


80 


F.10 Cassette I/O 






81 


F.11 Hardware 




ka 


81 


F.1 1.1 Power 




r 


81 


F.1 1.2 Custom Chips 




h 


Table of Contents 


(7 



Appendix G 



USA and International Models 

83 G.1 Keyboard Layouts and Codes 

85 G.1.1 USA Standard (Sholes) Keyboard 

88 G.1.2 USA Simplified (Dvorak) Keyboard 

89 G.1 .3 ISO Layout of USA Keyboard 

90 G.1. 4 English Keyboard 

91 G.1. 5 French and Canadian Keyboards 

93 G.1 .6 German Keyboard 

94 G.1. 7 Italian Keyboard 

96 G.1. 8 Western Spanish Keyboard 

97 G.2 ASCII Character Sets 
99 G.3 Certifications 

99 G.3.1 Radio Interference 

99 G.3. 2 Product Safety 

99 G.3.3 Important Safety Instructions 

100 G.4 Power Supply Specifications 



83 



Appendix H 



Conversion Tables 

103 H.1 Bits and Bytes 

106 H.2 Hexadecimal and Decimal 

107 H.3 Hexadecimal and Negative Decimal 
109 H.4 Graphics Bits and Pieces 

112 H.5 Peripheral Identification Numbers 

114 H.6 Eight-Bit Code Conversions 



103 .— 



Appendix I 



Firmware Listings 



125 



3 



VI 



Table of Contents 



L 



i 



k 



=3 

5 



Glossary 


219 


Bibliography 


243 


Index 


247 



Tell Apple Card 



Table of Contents f^jj" 



3 



Appendix A 



Appendix B 



is 
=3 



Appendix C 



CO 



c/1 

D) 

u 



The 65C02 Microprocessor 

2 Table A-1 Cycle Time Differences 



Memory Map 



16 


Table B-1 


19 


Table B-2 


20 


Table B-3 


22 


Table B-4 


24 


Table B-5 


25 


Table B-6 


26 


Table B-7 


27 


Table B-8 


28 


Table B-9 



Zero Page Use 
Page 3 Use 

Main Memory Screen Hole Allocations 
Auxiliary Memory Screen Hole Allocations 
Addresses SC000 Through SC03F 
Addresses SC040 Through $C05F 
Addresses SC060 Through $C07F 
Addresses SC080 Through SCOAF 
Addresses SC0B0 Through SCOFF 



Important Firmware Locations 

32 Table C-1 Serial Port 1 Addresses 

32 Table C-2 Serial Port 2 Addresses 

33 Table C-3 Video Firmware Addresses 

33 Table C-4 Mouse Port Addresses 

34 Table C-5 Apple lie Enhanced Video 

and Miscellaneous Firmware 

35 Table C-6 Apple He Monitor Entry Points 

and Vectors 



List of Figures and Tables 



IX 











II 


■ 








-— 


Appendix E 


Interrupts 




_ ■ 






45 Figure E-1 


Interrupt-Handling Sequence 


■■ 






58 Table E-1 


Activating Mouse Interrupts 




■ 




58 Table E-2 


Reading Mouse Interrupts 


IK 


Appendix F 


Apple II Series Differences 


■ 1 






80 Figure F-1 


Apple II, II Plus, and lie Hand Control 
Signals 


** 


■ 










Appendix G 


USA and International Models 


s 






85 Figure G-1 


USA Standard or Sholes Keyboard 








(Keyboard Switch Up) 








86 Table G-1 


Keys and ASCII Codes 


5? 






88 Figure G-2 


USA Simplified or Dvorak Keyboard 
(Keyboard Switch Down) 


£ 






89 Figure G-3 


ISO Version of USA Standard Keyboard 








(Keyboard Switch Up) 








90 Figure G-4 


English Keyboard (Keyboard Switch Down) 


4+ 






90 Table G-2 


English Keyboard Code Differences 
From Table G-1 


m~ 






91 Figure G-5 


French Keyboard (Keyboard Switch Down) 


^ 






92 Figure G-6 


Canadian Keyboard (Keyboard Switch Down) 


SH 






92 Table G-3 


French and Canadian Keyboard Code 
Differences From Table G-1 








93 Figure G-7 


German Keyboard (Keyboard Switch Down) 


ms 






93 Table G-4 


German Keyboard Code Differences 
From Table G-1 


% 






94 Figure G-8 


Italian Keyboard (Keyboard Switch Down) 






95 Table G-5 


Italian Keyboard Code Differences From 








Table G-1 






96 Figure G-9 


Western Spanish Keyboard (Keyboard 
Switch Down) 


i « 






96 Table G-6 


Western Spanish Keyboard Code 
Differences From Table G-1 


: ! 






98 Table G-7 


ASCII Code Equivalents 








100 Table G-8 


50 Hz Power Supply Specifications 


J 


^\ 




List of Figures and Tables 





u 

=3 



Appendix H 



4 
^ 



Conversion Tables 



104 


Table H-1 


105 


Figure H-1 


106 


Table H-2 


108 


Table H-3 


109 


Table H-4 


113 


Table H-5 


115 


Table H-6 


116 


Table H-7 


117 


Table H-8 


118 


Table H-9 


119 


Table H-10 


120 


Table H-11 


121 


Table H-1 2 


122 


Table H-1 3 



What a Bit Can Represent 
Bits. Nibbles, and Bytes 
Hexadecimal/Decimal Conversion 
Decimal to Negative Decimal Conversion 
Hexadecimal Values for High-Resolution 
Dot Patterns 
PIN Numbers 

Control Characters, High Bit Off 
Special Characters. High Bit Off 
Uppercase Characters. High Bit Off 
Lowercase Characters, High Bit Off 
Control Characters. High Bit On 
Special Characters. High Bit On 
Uppercase Characters, High Bit On 
Lowercase Characters. High Bit On 



=3 

5 



.4 



i 



List of Figures and Tables 



c 

I— I 

L 

t: 
t 
l: 

fc 

l 

■ 

L 

i 



•o 

CD 
— 
A3 
O 
O 



This volume. Volume 2 of the >App/e //c Reference Manual, 
contains nine appendixes, a bibliography, and a glossary. 

Appendix A contains a description of the differences between 
the 6502 and the 65C02 microprocessors, plus a reprint of the 
manufacturer's data sheet for the 65C02 microprocessor. 

Appendixes B and C contain tables of the important RAM. 
ROM. and hardware addresses in the Apple lie. The reader can 
use these tables to find locations by address, the index to find 
them by label, the firmware listings to find them as defined and 
used, and the chapters to find them described in the context of 
their function. 

Appendix B is a memory map of the Apple lie, including detailed 
tables of page zero, page three, the screen holes, and the 
hardware page. 

Appendix C lists the published firmware entry points, arranged 
by address, and indicates where in the manual they are 
described. The list includes I/O firmware (pages SC1 
through $CF) and Monitor firmware (pages SFO through SFF). 
For Applesoft interpreter firmware (pages $D0 through SEF), 
refer to the Applesoft BASIC Programmer's Reference Manual, 
Volumes 1 and 2. 

Appendix D discusses what operating systems and languages 
run on the Apple He. and what features they do and do not use. 

Appendix E describes how to use the Apple He's interrupt 
handling capabilities. 

Appendix F contains an overview of the differences among the 
Apple II series computers. 



Preface 



XIII 



Appendix G contains the keyboard layouts, code conversion 
tables, and external power supply characteristics of USA and 
international models of the Apple He. 

Appendix H contains reference tables for code and number 
base conversion. 

Appendix I contains a listing of the source code for the Monitor, 
enhanced video firmware, and input/output firmware contained 
in the Apple He. The listings do not include the built-in Applesoft 
interpreter, which is discussed in the Applesoft BASIC 
Programmer's Reference Manual. 

The Bibliography lists articles and books containing additional 
information about the Apple He and related products. 

The Glossary defines many of the technical terms used in this 
manual. 



fif 



xiv I Preface 



== 



L 

L 



CD 
"D 
■o 

CD 



This appendix contains a description of the differences 
between the 6502 and the 65C02 microprocessor. It also 
contains the data sheet for the NCR 65C02 microprocessor. 

In the data sheet tables, execution times are specified in 
number of cycles. One cycle time for the Apple lie equals 0.978 
microseconds. 

If you want to write programs that execute on all computers in 
the Apple II series, make sure your code uses only the subset 
of instructions present on the 6502. 



l: 



Appendix A: The 65C02 Microprocessor IT 



A 1 Differences Between 6502 and 65C02 



The data sheet lists the new instructions and addressing modes 
of the 65C02. This section supplements that information by 
listing the instructions whose execution times or results have 
changed. 



A. 1. 1 Differing Cycle Times 

In general, differences in execution times are significant only in 
time-dependent code, such as precise wait loops. Fortunately, 
instructions with changed execution times are few. 

Table A-1 lists the instructions whose number of instruction 
execution cycles on the 65C02 is different from the number on 
the 6502. 

Table A-1. Cycle Time Differences 







6502 


65C02 


Instruction/Mode 


Opcode 


Cycles 


Cycles 


ASL Absolute. X 


1E 


7 


6 


DEC Absolute. X 


DE 


7 


B 


INC Absolute. X 


FE 


7 


6 


JMP (Absolute) 


6C 


5 


G 


LSR Absolute. X 


5E 


7 


6 


ROL Absolute. X 


3E 


7 


6 


ROR Absolute, X 


7E 


7 


6 



~2l Appendix A: The 65C02 Microprocessor 



i 

i 



'i 

■ I 

\ 
J 






— i, 



A. 1.2 Differing Instruction Results 

It is important to note that the BIT instruction when used in 
immediate mode (code $89) leaves Processor Status Register 
bits 7 (N) and 6 (V) unchanged on the 65C02. On the 6502, all 
modes of the BIT instruction have the same effect on the Status 
Register: the value of memory bit 7 is placed in status bit 7, and 
memory bit 6 is placed in status bit 6. However, all BIT 
instructions on both versions of the processor set status 
bit 1 (Z) if the memory location contained a zero. 

Also note that if the JMP indirect instruction (code $6C) 
references an indirect address location that spans a page 
boundary, the 65C02 fetches the high-order byte of the effective 
address from the first byte of the next page, while the 6502 
fetches it from the first byte of the current page. For example, 
JMP (S2FF) gets ADL from location $2FF on both processors. 
But on the 65C02, ADH comes from $300; on the 6502, ADH 
comes from $200. 



A.1 Differences Between 6502 and 65C02 



[3 



A.2 Data Sheet 



The remaining pages of this appendix are copyright 1982, 
NCR Corporation, Dayton, Ohio, and are reprinted with their 
permission. 



5= 



m 

j 



~l\ Appendix A: The 65C02 Microprocessor 






l — J 

t 

L 

c 

L 

E 

i: 

E 



NCR 



GENERAL DESCRIPTION 



The NCR CMOS 6502 it an 8-bit microprocessor which is soft- 
ware compatible with the NMOS 6602. The NCR65C02 hardware 
interlaces with all 6500 peripherals. The enhancements include 
ten additional instructions, expanded operational codes and 
two new addressing modes. This microprocessor has all of the ad- 
vantages of CMOS technology: low power consumption, increased 
noise immunity and higher reliability. The CMOS 6502 is a low 
power high performance microprocessor with applications in the 
consumer, business, automotive and communications market. 



■ FEATURES 

• Enhanced software performance including 27 additional OP codes 
encompassing ten new instructions and two additional 
addressing modes. 

• 66 microprocessor instructions. 

• 15 addressing modes. 

• 1 78 operational codes. 

• 1MHz. 2MH* operation. 

• Operates at frequencies as low 
as 200 Hz for even lower power 
consumption (pseudo-static: stop during ©2 high). 

• Compatible with NMOS 6500 series 
microprocessors. 

• 64 K-byte addressable memory. 

• Interrupt capability. 



NCR65C02 



PIN CONFIGURATION 



vssi , 


• 


m 


— nr? 


BDV[^ 


* 


m 


^OjlOUH 


OUTI [_ 


3 


ii 


=156 


IROI 


• 


17 


Do iix» 


ate 


S 


16 


Zlw 


SOiCZ 


• 


>^ 


D« 


*"ic c 


7 


s* 


Z|H-ff 


VDOC 


■ 


]J 


Dm 


AOC 


« 


H 


ZJ01 


«c 


., 


SI 


=|oj 


«c 


" 


30 


Z)DJ 


«c 


" 


."- 


no* 


«C 


1! 


JH 


=|OS 


«C 


1« 


11 


_; •' 


«c 


1* 


."' 


ZJ0T 


*'C 


IB 


11 


D*<» 


«c 


17 


M 


D*'» 


*»C «B 


« 


ZI"J 


AlOC 


19 


.'-' 


ZMn 


Anc 


50 


31 


ID vss 



• NCR65C02 BLOCK DIAGRAM 






■ 

on t*Q Wi 



Lower power consumption. 
4mA & 1MHz. 

+5 volt power supply. 

8-bit bidirectional data bus. 

Bus Compatible with M6800. 

Non-maskable interrupt. 

40 pin dual-in-line packaging. 

8-bit parallel processing 

Decimal and binary arithmetic. 

Pipeline architecture. 

Programmable stack pointer. 

Variable length stack. 

Option al int ernal pull ups for 
(RDY, IRQ, 50, NMI and RESl 



Specifications are subject to 
change without notice. 









; 

* 


»TU 4 






* 


kit ^ 
*IJ -• 

"7 ^» 


.„- 




■ 1*^ 








An^ 

















fr 




Copyright ©19B2 bv NCR Corporation, Dayton, Ohio, USA 



A. 2 Data Sheet 



IF 



"el 



NCR65C02 

■ ABSOLUTE MAXIMUM RATINGS: 



(V DD '5.0 V 15%, Vss =0V,T A -0"to + 70"Cl 



RATING 


SYMBOL 


VALUE 


UNIT 


SUPPLY VOLTAGE 


V DD 


-0.3 to* 7.0 


V 


INPUT VOLTAGE 


v (N 


0.3 to -/() 


V 


OPERATING TEMP. 


T A 


10 + 70 


°c 


STORAGE TEMP. 


TSTG 


-SB to + 150 


°c 



PIN FUNCTION 



PIN 



A0-A15 



DO- D7 



rrro 



RDY" 



Ml 



■■J Mi 



SYNC 



"rTT 



so 



NC 



H \\ 



VDD 



VSS 



BQ 



01.02 



FUNCTION 



Add-ess. Bui 



Djtd Bus 



Interrupt Request 



Ready 



Memory Lock 



Non-Maskable Interrupt 



Synchronize 



Reset 



Set Overflow 



No Connection 



Read/ Write 



Power Supply (*5V) 



Internal Logic Ground 



Clock Input 



Clock Outpul 



•Thij ntn fwu an optional internal pu 



Iup (or 4 No Conned conditio" 



■ DC CHARACTERISTICS 



Appendix A: The 65C02 Microprocessor 





SYMBOL 


MIN. 


TYP. 


MAX 


UNIT 


Input High Voltage 

00 (IN) 
Input High Voltage 

RES, NMi. RDY. IRQ. Data. S.O. 


V|H 


V SS • 2.4 
Vss * 2° 


- 


v D o 


V 

V 


Input Low Voltage 
OOHNI 
RES, NMt. RDY, IRQ, Data, S.O. 


V.L 


V SS -03 


- 


Vss * °- 4 
Vss* 0.8 


V 
V 


Input Leakage Current 

( V )N - to 5.25V, V 0D = 5.25V) 
With pullups 
Without pullups 


llN 


-30 


- 


♦30 

+1.0 


/lA 


Three State (0t( State) Inpul Current 
(V, N - 0.4 to 2.4V, V cc ■ 5-25V) 
Data Ltnes 


Itsi 






10 


HA 


Output High Voltage 

|l OH =-100 /<Adc, V DD = 4.75V 
SYNC. Data, A0A15, R/W) 


V H 


Vss * 2.4 






V 


Out Low Voltage 

|| 0L = 1.6mAdc. V DD ^ 4.75V 
SYNC, Data, AQ-A15, R/W) 


Vol 






Vss * ° " 


V 


Supply Current t =■ 1MH* 
Supply Current f - 2MHz 


'OD 


— 


_ 


A 

8 


mA 
mA 


Capacitance 

Win -0. T a =25°C, 1 - 1MHz) 
Logic 

Data 

A0-A15. R/W, SYNC 

«0"Nr 


c 

Cjn 

Cout 
CBollNI 






5 
10 
10 
10 


pF 









■ 

A 

;.! 
1 



l: 

i - 

L 

l: 



|__^j 



NCR65C02 

■ AC CHARACTERISTICS v D0 = 5.0V 15%. t a = o°c to 70°c. Load- 1 ttl + 130 p f 






IMhz 


2Mhz 


3Mhz 




Parameter 


Symbol 


Mm 


Max 


Min 


Max 


Min 


Max 


Unit 


Delay Time. O (IN) lo 82 (OUT) 


t'JL ■ 


- 


60 




60 


20 


60 


nS 


Delay Time. 0i (OUT) to &2 (OUT! 


*OLY1 


20 


20 


-20 


20 


-20 


20 


nS 


Cycle Time 


tcvc 


1 


5000" 


0.50 


5000' 


0.33 


5000' 


*s 


Clock Pulse Wiillh Low 


tPL 


460 


- 


220 


- 


160 




nS 


Clock Pulse Width High 


tpH 


460 


- 


220 


- 


160 


- 


nS 


Fall Time. Rise Time 


If.tR 


- 


2b 


- 


25 


- 


25 


nS 


Address Hold Time 


tAH 


20 


- 


20 


- 





- 


nS 


Address Setup Time 


Uds 


- 


225 


- 


140 


- 


110 


nS 


Access Time 


tACC 


650 


- 


310 


- 


170 


- 


nS 


Read Data Hold Time 


tDHR 


10 


- 


10 


- 


10 


- 


nS 


Read Data Setup Time 


tDSU 


100 




60 


- 


60 


- 


nS 


Write Data Delay Time 


tMDS 


- 


30 


- 


30 


- 


30 


nS 


Write Data Hold T. me 


UJHW 


20 


- 


20 


- 


15 


- 


nS 


SO Setup Time 


tso 


100 


- 


100 


- 


100 


- 


nS 


Processor Control Setup Time" 


tpcs 


200 


- 


150 




150 


- 


nS 


SYNC Setup Time 


<S . N L 


- 


225 


- 


140 


- 


100 


nS 


ML Setup Time 


tMt 




225 


- 


140 


- 


100 


nS 


Input Clock Rise/Fall Time 


tftki.lROo 


- 


25 




25 


- 


25 


nS 



'NCR65C02 can be held static with 
* "This parameter must only be met 



02 high. 

to guarantee that the signal will be recognized at the current clock cycle. 



- MICROPROCESSOR OPERATIONAL ENHANCEMENTS 



Function 


NMOS 6502 Microprocessor 


NCR65C02 Microprocessor 


Indexed address«ig across page boundary 


Extra read of invalid address. 


Extra read of last instruction byte. 


Execution ol Invalid op codes. 


Some terminate only by reset. Results 
are undefined. 


All are NOPs (reserved for future use). 
Op Code Bytes Cycles 
X2 2 2 
X3. X7, XB. XF 1 1 
44 2 3 
54. 04. F4 2 4 
5C 3 B 
DC. FC 3 4 


Jump Indirect, operand = XXFF, 


Page address does not increment. 


Page address increments and adds one 
additional cycle. 


Read/modify/write instructions at 
effective address. 


One read and two wrne cycles. 


Two read and one write cycle. 


Decimal flag. 


Indeterminate after reset. 


Initialized to binary mode (D=0) after 
reset and interrupts. 


Flags after decimal operation. 


Invalid N. V and Z flags. 


(lag adds one additional cycle. 


Interrupt after fetch of 8RK insm.c- 
tion. 


Interrupt vector is loaded. BRK vector 
is ignored. 


BRK is executed, then interrupt is 
executed. 



■ MICROPROCESSOR HARDWARE ENHANCEMENTS 



Function 


NMOS 6502 


NCR65C02 




Assertion of Ready RDYdunnij 
write operations. 


Ignored. 


Stops processor during 02- 




Unused input-only pins (IRQ, NMl, 
RDY. WES. SO). 


Must be connected to low impedance 
signal lo avoid noise problems. 


Connected internally by a high- 
resistance to Voo (approximately 250 
K ohm.) 





A.2 Data Sheet 



17 



NCR65C02 

• TIMING DIAGRAM 



•1 
o 2 

ADDR, R/VV 

READ DATA 

WRITE DATA 

SYNC 

ML 

RDY, fRQ 
NMl, RES 

SO 



4 ^D. 



y^ 



t 



'F«o 



-'Di 



■ 






£ 



fz 



\ 






- 'h 



/ 



n 



T" 



l DSU ■- 



E: 



5t 






- 1, 



h— *i 



X 



.' 



Note: All liming is referenced from a high voltage of 2.0 volts and a tow voltage of 0.6 volti. 






NEW INSTRUCTION MNEMONICS 



HEX 
80 

JA 

1A 

DA 

5A 

FA 

7A 

9C 

91 

64 

74 

10 

14 

UC 

04 



MNEMONIC 
HHA 
DEA 
INA 
PHX 
PHY 
PLX 
PLY 
ST2 
STZ 
STZ 
STZ 
TRB 
TRB 
TSB 
TSB 



DESCRIPTION 
Branch relative always (Relative] 
Decrement accumulator [Accum] 
Increment accumulator lAccuml 
Push X on stack [Implied! 
Push Y on stack (Implied] 
Pull X from stack llmpliedj 
Pull Y from stack (Implied) 
Store zero (Absolute! 
Store zero |A8S. X] 
Store zero [Zero page! 
Store zero (ZPG.X] 

Test and reset memory bits with accumulator [Absolute! 
Test and reset memory bits with accumulator (Zero page] 
Test and set memory bits with accumulator [Absolute! 
Test and set memory bits with accumulator [Zero pagel 



■ ADDITIONAL INSTRUCTION ADDRESSING MODES 



HEX 

72 
32 
3C 
34 
D2 
52 
7C 
B2 
12 
F2 
0? 



MNEMONIC 
ADC 
AND 
BIT 
BIT 
CMP 
EOR 
J MP 
LDA 
ORA 
SBC 
STA 



DESCRIPTION 

Add memory to accumulator with carry [(ZPG)] 
"AND" memory with accumulator ((ZPG)] 
Test memory bits with accumulator lABS. X| 
Test memory bits with accumulator IZPG. Xl 
Compare memory and accumulator [(ZPG) 1 
"Exclusive Or" memory with accumulator [(ZPG) 
Jump (New addressing mode) [ABS(IND,X|] 
Load accumulator with memory [(ZPGU 
"OR" memory wtth accumulator [(ZPG) I 
Subtract memory from accumulator vvith borrow ( 
Store accumulator in memory [(ZPG)I 



(ZPGU 



i 

J 

Li 

.1 

!i 



J] 



Appendix A: The 65C02 Microprocessor 



L 



l: 



NCR65C02 



■ MICROPROCESSOR PROGRAMMING MODEL 



ps&_ 



3 ACCUMULATOR A 

J INDEX REGISTER V 

] INDEX REGISTER X 

J PROGRAM COUNTER PC 



^T~P 



StACK"QINTEH5 



REG P" 



CARRV 1 -TRUE 
ZERO 1 'RESULT ZERO 

fTO DI5ABLE ' - OISABLE 
DECIMAL MODE I -TRUE 
HRK COMMAND > ■ BRK 
OVERFLOW I -TRUE 
NEGATIVE 1 - NEG 



■ FUNCTIONAL DESCRIPTION 



C 



m ^ 

L" 

■ — « 

L 



Timing Control 

The liming conuol unit keeps track ol the instruction 
cycle being monitored. The unit is set to zero each time 
an instruction fetch is executed and Is advanced at the 
beginning ol each phase one clock pulse lor as manv 
cycles as is required to complete the instruction. Each 
data transfer which takes place between the registers de- 
pends upon decoding the contents ol both the instruc- 
tion register and the timing control unit. 

Program Counter 

The 16-bit program counter provides the addresses which 
step the microprocessor through sequential msfuctions 
in a program. 

Each time the microprocessor (etches an instruction 
from program memory, the lower byte of the program 
counter (PCLl is placed on Ihe low-order bits of the 
address bus and the higher byte of the program counter 
(PCH) is placed on the high-order 8 bits. The counter is 
incremented each time an instruction ot data is fetched 
from program memory. 

Instruction Register and Decode 

Instructions fetched from memory are gated onto the 
internal data bus. These instructions are latched into the 
instruction register, then decoded, along with timing and 
interrupt signals, to generate control signals for the var- 
ious registers 

Arithmetic and Logic Unit (ALU) 
All arithmetic and logic operations take place in the 
ALU including incrementing and decrementing Internal 
registers (except the program counter). The ALU has no 
internal memory and is used only to perform logical and 
transient numerical operations. 



Accumulator 

The accumulator Is a general purpose 8-bit register that 
stores the results of most arithmetic and logic operations, 
and in addition, the accumulator usually contains one of 
the two data words used in these operations. 

Index Registers 

There are two 8-bit index registers (X and Y), which 
may be used to count program steps or to provide sn 
index value to be used in generating an effective address. 

When executing an instruction which specifies indexed 
addressing, the CPU fetches the op code and the base 
address, and modifies the address by adding the index 
register to it prior to performing the desired operation. 
Pre- or post-indexing of indirect addresses is possible (see 
addressing modes). 

Suck Pointer 

The slack pointer is an 8-bit register used to control the 
addressing of the variable-length stack on page one. The 
stack pointer is automatically incremented and decre- 
mented under control of the microprocessor to perform 
stack manipulations under direction of either the program 
or interrupts (NMI and IRQ). The stack allows simple 
implementation of nested subroutines and multiple level 
interrupts. The stack pointer should be initialized before 
any interrupts or stack operations occur. 

Processor Status Register 

The 8-bit processor status register contains seven status 
flags. Some of the flags ate controlled by the program, 
others may be controlled both by the program and the 
CPU. The 6500 instruction set contains a number of 
conditional branch instructions which are designed to 
allow testing of these flags (see microprocessor program- 
ming model I. 



•4 



A.2 Data Sheet 



IT 



NCR65C02 

- ADDRESSING MODES 

Fifteen addressing modes are available to the user of the 
NCR65C02 microprocessor. The addressing modes arc 
described in the following paragraphs. 

Implied Addressing (implied! „j_i«, 

In the implied addressing mode, the address containing 
the operand is implicitly »aled 'n the operation code o» 
the instruction. 

Accumulator Addressing (Aecuml 

This form of addressing is represented with a one byte 
instruction and implies an operation on the accumu- 
lator. 

Immediate Addressing (Immediate) 

With immediate addressing, the operand is contained in 
the second byte of the instruction; no further memory 
addressing is required. 

Absolute Addressing lAbsolutel 

For absolute addressing, the second byte of the mstruc 
tion specifies the eight low-order bits of the effective 
address, while the third byte specifies the eight h.gh-o.der 
bits. Therefore, this addressing mode allows access to me 
total 64K bytes of addressable memory. 

Zero Page Addressing ( Zero Pagel 

Zero page addressing allows shorter code and execution 
limes by only fetching the second byte of the instruction 
and assuming a zero high address byte. The careful use 
of zero page addressing can result in significant increase 
in code efficiency. 

Absolute Indexed Addressing [ABS. X or ABS. Y| 
Absolute .ndexed addressing <s used in conjunction with 
X o. Y index register and is referred to as "A^ 1 "^-*' 
and "Absoluie. Y." The effective address is formed by 
adding the contents of X o. Y to the address contained 
in the second and third bytes of the instruction Tms 
mode allows the index register to contain the .nde*^ or 
count value and the instruction lo contain the base 
address. This type of indexing allows any location refer- 
encing and the index to modify multiple fields, resulting 
in reduced coding and execution time. 
Zero Page Indexed Addressing IZPG. X or ZPG. Y] 
Zero page absolute addressing is used in conjunction 
with the index register and is referred to as "Zero Page 
X" or "Zero Page, Y." The effective address is calculated 
by adding the second byie to the contents of the index 
register Since this is a form of "Zero Page addressing, 
the content of the second byte references a location in 
paqe zero. Additionally, due to the "Zero Page address 
ina nature of this mode, no carry is added to the high- 
order eight bits of memory, and crossing of page boun- 
daries does not occur. 
Relative Addressing (Relative! 
Relative addressing is used only with branch instructions. 



(I establishes a destination for the conditional branchy 
The second byte of the instruction becomes the operand 
which is an "Offset" added to the contents of the pro- 
gram counter when the counter is set at the next in- 
struction. The range of the offset is -128 to *127 
bytes from the next instruction. 
Zero Page Indexed Indirect Addressing KIND Xtl 
With zero page indexed indirect addressing (usually re- 
ferred to as indirect XI the second byte of the instruction 
h added to the contents of the X index register; the 
carry is discarded. The result of this addition points to a 
memory location on page zero whose contents «£■'•*; 
order eight bits of the effective address. ^« «« fn«m 
orv location in page zero contains the rugh-order eight 
bits of the effective address. Both memory locations 
specifying the high- and low-order bytes of the effective 
address must be in page zero. 

•Absolute Indexed Indirect Addressing lABStlND. XII 
(Jump Instruction Only) ,„..„. 

With absolute indexed indirect addressing the contents of 
the second and third instruction bytes are added to the 
X register. The resull of this addition, points « a memory 
location containing the lower-order eight bus i of me 
elective address. The next memory location contains 
the higher-order eight bils of the effective address. 

Indirect Indexed Addressing IlIND). Y) 
Th, s form of addressing is usually referred to as Indirect, 
Y The second byie of the instruction points to a mem 
ory location ,n page zero. The «"^ ^V "^iTx S 
location are added to the contents of the Y «*" "fl« 
ter, the result being the low-order eight bits of the of tec- 
live address. The carry from this addition !*•*««> J» 
contents of the ne-t page zero memory location the 
result being the high-order eight bits of the elective 
address. 

•Zero Page Indirect Addressing I (ZPG II 
In the zero page indirect addressing mode, the second 
byte of the instruction points to a memory ocaonon 
page zero containing the low-orde. byte of the effective 
address. The next location on page zero contains the 
high-order byte of the effective address. 
Absolute Indirect Addressing ((ABStl 
(Jump Instruction Only! 

The second byte of the instruction contains the 'warder 
eight bits of a memory location. The h.gh-o.der eight 
bits of that memory location Is contained In he third 
byte of the instruction. The contents of the fully spec. 
tied memory location is the low-order byte of the effec- 
ts address. The next memory location con .ms the 
high-order byte of the effective address which is loaded 
into the 16 bit program counter. 

NOTE " : New Address Modes 



^ 









lol 



Appendix A: The 65C02 Microprocessor 






■ SIGNAL DESCRIPTION 

Address Bus <A0 A 15* 

A0-A15 forms a 16-bit address bus (or memory and I/O 
exchanges on ihe data bus. The output of each address 
line is TTL compatible, capable of driving one standard 
TTL load and T30pF. 

Clocks (On. 0i, and ©2) 

00 '* a TTL level input that is used to generate the inter- 
nal clocks tn the 6502. Two lull level output clocks are 
generated bv the 6502. The Qj clock output is in phase 
with 00. The 0] output pin is 180" out ot phase With 0g. 
(See timing diagram.) 



Data Bus <D0 D7I 

The data lines IDO D7) constitute an 8 lm bidirectional 
data bus used for data exchanges to and from the device 
and peripherals. The outputs are three-state butlers 
capable of driving one TTL load and 130 pF 

Interrupt Request (IRQ) 

This TTL compatible input requests that an in terru pt 
sequence begin withm ihe microprocessor The IRQ is 
sampled during 02 operation, if the interrupt hag in the 
processor status register is rero, the current instruction 
is completed and the interrupt sequence begins during 
01 The program counter and processor status register 
are stored m the stack. The microprocessor will then set 
the interrupt mask flag high so that no further IRQs 
may occur. At the end ol this cycle, the program countei 
low Will be loaded from address FFFE, and program 
counter high from location FFFF, transferring program 
control to the memory vector located at these addresses 
The RDV signal must be m the high state lor any inter- 
rupt to be tecognifed. A 3K ohm external resistor should 
be used far proper wire OR operation. 

Memory Lock IML) 

In a multiprocessor system, the ML output indicates Ihe 
need to deler the rearbitration of the next bus cycle to 
ensure the integrity of read-modify-writo instructions 
ML goes low during ASL, DEC, INC, LSR, ROL, ROR. 
TRB, TSB memory referencing instructions. This signal 
is low for the modify and write cycles. 

Nan-Maskable Interrupt (NMl) 

A negative-going edge nn this input requests that a non- 
maskable interrupt sequ ence be generated within the 
microprocessor. The NMl is sampled during 02. the cur- 
rent instruction is completed and the interrupt sequence 
begin* during 0i_ The program counter u loaded with 
the interrupt vector from locations FFFA (low byte) 
and FFFB (high bytel, thereby transferring program con- 
trol to the nonmaskable interrupt routine. 



NCR65C02 



Ready (RDV) 

This input allows the user to single-cycle the micropro- 
cessor on all cycles including write cycles. A negative 
transition to the low state, during or coincident with 
phase one (0i), will halt the microprocessor with the out- 
put address lines reflecting the current address being 
fetched. This condition will remain through a subsequent 
phase two (02l in which the ready signal is low. This fea- 
ture allows microprocessor interfacing with low-speed 
memory as well as direct memory access IDMA). 

Reset (RES) 

This input is used to reset the microprocessor. Reset 
must be held low for at least two clock cycles after 
VDD reaches operating voltage from a power down. A 
positive transition on this pm will then cause an initiali- 
zation sequence to begin. Likewise, after the system has 
been operating, a low on this line of at least two cycles 
will cease microprocessing activi ty, f ollowed by initial 
iiation after the positive edge on RES. 

When a positive edge is detected, there is an initialization 
sequence lasting six clock cycles. Then the interrupt 
mask flag is set, the decimal mode is cleared, and the pro- 
gram counter is loaded with the restart vector from loca- 
tions FFFC (low byte) and FFFD (high bytel. This is 
the start location for program control. This input should 
be high in normal operation. 

Read/Write tR/Vrf) 

This signal is normally m the high state indicating that 

the microprocessor is reading data from memory or I/O 

bus. In the low state the data bus has valid data from the 

microprocessor to be stored at the addressed memory 

location. 

Set Overflow (SOI 

A negative transition on this line sets the overflow bit in 
the status code register. The signal is sampled on the trail- 
ing edge of 0j. 

Synchronize (SYNC) 

This output line is provided to identify those cycles dur- 
ing which the microprocessor is doing an OP CODE 
fetch. The SYNC line goes high during 0, of an OP CODE 
fetch and stays high for the remainder of that cycle. If 
the RDY line is pulled low during the 0| clock pulse in 
which SYNC went high, the processor will stop in its 
current stale and will remain in the state until the RDY 
line goes high. In this manner, the SYNC signal can be 
used to control RDY to cause single instruction execu- 
lion 



c 



Note Since this interrupt is non-maskable, another NMl 
can occur b efore the first is finished. Care should be taken 
when using NMl to avoid this. 



A.2 Data Sheet 



rrr 



- INSTRUCTION SET - ALPHABETICAL SEQUENCE 



AOC Add Memory 10 Accumulator with Carry 

AND "AND" Memory w ,,h Accumulator 

A5L Sin it On« 6»l Leli 

flCC Branch on Carry Cleat 

BCS Branch on Carry S«I 

BEQ B'anch on Retult Zero 

81 T Tett Memory Bid with Accumulator 

BMI Branch on Retult Mmui 

BNE Branchon Ratuli not Zero 

BPL Branch on Retult Plui 

*BHA Branch Aiwayi 

BRK Fores Break 

BVC B'anch on Overflow Ow 

BVS B'anch on Overflow Set 

CUC Clea- Carry "•0 

CLO Clear Decimal Wad* 

CLI Clear Interrupt Citable Bt| 

CLV Clear Overflow Flag 

CMP Compare Memory and Accumulator 

CPX Compare Memory and Index X 

CPY Compare Memory and Indei V 

" DEA Decrement Actumulaior 

DEC Decrement by One 

DEX Decrement Index X by One 

DEV Decmment Index Y by One 

EOR "Eacluuve- or" Memory with Accumulato' 

" INA Increment Accumulator 

INC Increment by One 

INX Increment Index X by One 

INY Increment Index Y by One 

JMP Jump 10 New Location 

JSR Jump to New Location Saying Return Addren 
LDA Load AccumulaiO' w>th Memory 

Note: * = New Instruction 

■ MICROPROCESSOR OP CODE TABLE 



LDX Load Index X with Memory 

LDY Load Index V with Memory 

LSR Sh.'tOne B>t Right 

NOP No Operation 

ORA "OR" Memory with Accumulator 

PHA Puin Accumulator on Stack 

PHP Puih Pioceitor Statu* on Stack 

1 PH X Puth I nde* X on Slack 

1 PHY Puth Index Y on Stack 

PLA Pull Accumulator Irom Stack 

PLP Pull Procewo' Sietui Irom Stack 

' PLX Pull Index X Irom Stack 

' PLY Pull Index Y Irom Stack 

ROL Rotate One Bn Left 

ROR Rotate One Bn Right 

ATI Reium from Interrupt 

RT5 Return Iron) Subroutine 

SBC Subtract Memory from Accumulator w>th Borrow 

SEC Set Carry Flag 

SEO Set Decimal Mode 

SEI Set Interrupt Citable Bn 

STA Store Accumulator in Memory 

STX Store Index X m Memory 

STY Store Indei Y m Memory 

• STZ Store Zero m Memory 

TAX Trantfer Accumulator to Index X 

TAY Traniler Accumulator to Indea Y 

• TRB Ten and Reiet Memory B>t> With Accumulator 

• TSB Tett and 5ei Memory Bti With Accumulator 
TSX Traniler Stack Po.mer to Indea X 

TXA Trarwler Index X to Accumulator 

TXS Trantfer Index X lo Stack Pointer 

TYA Tramfer Index Y to Accumulator 



s 





1 


7 


3 


4 


5 


6 


7 


B 


9 


A 


B 


C 


D 


E 


■ 









BHr- 


ORA 
rod, x 






TSB* 


ORA 
'PB 


ASL 

»pg 




PHP 


ORA 

imm 


ASL 

A 




TSB" 

Obi 


ORA 
am 


ASL 
abt 








1 


BPL 


ORA 
ind, V 


IRA'1 
lipgl 




TRB" 


ORA 
fpg • 


ASL 
ipg * 




CLC 


ORA 
aut, Y 


INA" 
A 




TRB* 
aba 


ORA 
abi. X 


ASL 
abt.X 








7 


JSR 
aU 


AND 

md, • 






BIT 


AND 
*P9 


ROL 
tog 




PLP 


AND 

tmm 


ROL 
A 




BIT 

ni'i 


AND 


ROL 

abi 




7 




3 


BMI 

ret 


AND 
md.Y 


AND't 
lipgr 




BIT" 
*Pfl. * 


AND 

/P9. X 


ROL 
•OS.* 




SEC 


AND 
abi, Y 


DEA* 
A 




BlT't 

aba. x 


AND 
STM, X 


ROL 

abi, X 








4 


RTI 


EOR 
ind. X 








EOR 

*pg 


LSR 

■pg 




PHA 


EOR 
iitim 


LSR 
A 




JMP 
abt 


EOR 
abi 


LSR 

abt 








5 


BVC 

rel 


EOR 

tnd. Y 


EOH't 

i'pgi 






EOR 

'OH. • 


LSR 

■pg.x 




CLI 


EOR 
abi. Y 


PHV 






EOR 
abt.X 


LSR 
abt.X 




5 




6 


RTS 


AOC 

ind, x 






5TZ* 

•pg 


ADC 
/pg 


ROR 
/pg 




PLA 


ADC 

imm 


ROR 
A 




JMP 
(abil 


ADC 
abt 


ROR 
abi 








7 


BVS 

i*i 


ADC 
ind, Y 


ADC* 

i/pgi 




STZ' 

ipg, X 


ADC 

ipg. x 


ROR 

* pg. X 




SEI 


ADC 
abi. Y 


PLY' 




JMP't 
abilmd.Xl 


ADC 
abt.X 


ROR 

abt. X 




1 




B 


BRA* 

■el 


STA 
ind, X 






STY 
*og 


STA 

-'i"i 


STX 

•pg 




DEV 


BIT- 
tmm 


TXA 




STY 

abi 


STA 
abi 


STX 
ata 




B 




9 


BCC 
rel 


STA 

ind. Y 


STA't 

(fpg) 




STY 
*P9, X 


STA 

*pg. x 


STX 
«>g.Y 




TYA 


5TA 
abi. Y 


TXS 




STZ" 
ab« 


STA 

abt.X 


STZ' 
abt.X 




9 




A 


LDY 


LOA 

ind. X 


LDX 




LDY 

■pg 


LDA 
■pg 


LDX 
»P9 




TAY 


LOA 
imm 


TAX 




LDY 
abi 


LDA 


LDX 

abt 




A 




H 


BCS 

eel 


LDA 
ind. V 


. L'A-1 

</pg> 




LDY 
»P9, X 


LDA 
tPQ. X 


LDX 

/pg.Y 




CLV 


LDA 
abi, Y 


TSX 




LOY 

abi, X 


LDA 
abt.X 


LDX 
abt Y 




B 




C 


CPV 


CMP 






CPY 

■pg 


CMP 
*P9 


DEC 
■PB 




INV 


CMP 
imm 


DEX 




CPY 
abi 


CMP 
abi 


DEC 
abt 




C 




D 


rel 


CMP 
md. V 


CMP*1 
l-pgt 






CMP 
/pg, X 


DEC 

*pg.x 




CLD 


CMP 
abt. V 


PHX- 






CMP 
abi. X 


OEC 




T D 




E 


CPX 


SBC 

ind. X 






ii',; 


SBC 

m 


INC 

/pg 




INX 


SBC 
imm 


NOP 




CPX 
ahi 


SBC 

abi 


(NC 
abt 




t 




f 


BEQ 
rel 


SBC 
tnd. Y 


SBC*1 

tippjl 






SBC 

■;■!. ' 


INC 
*pg. x 




SED 


SBC 
Km 1 


PLX' 






SBC 
abi, K 


INC 




F 






D 


1 


2 


3 


4 


& 


S 


7 


8 


9 


A 


B 


C 





E 


• 







Note: * ■ New OP Codes 
Note t = New Address Modes 






J 

I 

J 
1 



151 



Appendix A: The 65C02 Microprocessor 



I 



■ — * 



1 



NCR65C02 



OPERATIONAL CODES, EXECUTION TIME, AND MEMORY 
REQUIREMENTS 



1 
=5 

3 



i 
i 

i 





IMM 

I.IAT 


ABSO 

l !■: 


:i" 

PAii 

' - 
65 1 

:■ 
- : 


1 

1... L 


IM 


UNO 
XI 


' 

V 


7PG 


t ?p& 


• ABJ 


All-. 


»tlA 


IA«I 


ABS 

UNO. HI (3PQ 


P" OCI 510* 
SI AT LA COOES 




MM 


OPERATION 


;,n - 


■ 1 


- 

4 


POP - 

1 

: 

; i'.i ; 


• . ■ 


■ - 




,.. 




OP - 


. ... 


. ■- 


. 1 - 


. - 




,. 


' 


V , 


1 ip 


1 J 1 4 J . 


ONI 




1 1. . B D 1 Z ■: 




AOC 
A-T 
All 

•cc 

hi-. 


A • M - C - A II]) 
AAM-A HI 
O-tl I- ■ III 
B<*«J* IC-O III 
Bunch IC-I 131 


M 1 

:9 : 


1 n 


1 




1 




s 


>•> * 

K ■ 
i« , 


1 


:: 1 
IE B 


1 ., , 

) 


1 
> 


3 
J 








'7 S 
33 S 


3 N V 7 C 

7 N Z 

N ZC 


A,",, 

an; 
a-.. 

B£C 

VI . 




u a 

■IT 

MM 

■ME 

l"\ 

i- .i • 
»" . 
■vc 
■VI 
C L E 


■•Inch i* 2 1 171 
A AM HJI 

Bnnd - N 1 131 
«k«"c» J 7-0 171 

B> ••«.•' ■ *U -0 III 


p* l 




• 


1» . 


J 












M • 


: 




ic 4 


1 


- 

K 

J: 


: 
2 

: 










■y*r 7 


■n 

■Ml 

B»l 




B-.".»A«r.. 171 

In* 

B'.»._*-v-0 IJI 
Bwit" d V-t Ql 
0-C 












IS 7 


1 
1 
















-- 

H 

10 


■ 

: 
: 










T 1 

a 


■fU 

l,M. 

■VG 

■VI 

:lc 




OLD 
CLI 
CLV 

CMP 

:"■ 


I'D 

0-1 

o-v 

A M III 
■ M 


■ ■ : 
to ; 


. CI 

.' EC 




■-- 1 


3 


OS 7 
SB 7 
US J 


1 
< 
1 
( ' 


- 


Oi 


- 


..- . 


J 


0O4 


M 1 


3 










03 S 






D 

7 N I C 
N 2 C 


Ll V 

;.„■ 




□I* 
DEC 
D*» 
ae ■ 


V M 

A 1 -A 
M 1 -U 
■ 1 - ■ 
* l-V 


•-L J 


CE 


• 


CM H 


: 
ia 7 

3 


H ; 


1 








" 


; 


OCI 


J 














N 2 C 
N 

N 7 

N 1 
— 1 


on 

M ■ 

LL'. 
l.i • 
[It' 




IM* 

INC 

r. . 

in. 


: g VI - ■■• 

A • I-A 

M'l-W Ml 

■ . !•■ 

V.1*V 


a ; 


: - 
■ - 


g 


£6i 


■' 

IA 3 
1 


El 3 


l- 
1 




• I 




■■. 1 

>■■ 1 


J 


r .:i . 

'( E 


) 


> 










S7 B 


7 N Z 

N / 

n r 

N 2 
N 2 


1 '■• 
I1A 

IM 

INI 

INV 




Ml 

M 
LDI 


.. m ia rm in. 

. ■ . .■ ■ - 

M*» Hi 

M-» 

M-» (II 


M . 

- . 


•1 

;: 

: --i 

. = 


a 
• 


AS I 
Afi ) 


1 

3 

: 




fcl 


i 


■-■' 


-T 




3 

■ ■i | 


10 4 
7 

BC 4 


1 . 

BI 4 

I 


1 

3 




■1 


' 


•: 


.1 
B7 B 


3 N 7 
N 2 

N Z 


JSP 
LOA 

1 ■• 




urn 

N * 
I ".- 

PHA 


■ • -1 

A V If * A l|l 

A-M, S l-S 

■•«*, S 1-5 


■ •• : 


: m 


• 


II 1 
"'. 1 


. 1 . 

1 


<A 7 

48 3 
OB j 


01 

1 


■ 


11 


' 


-,t ( 
It 4 


3 
3 


1 ■ 

ID4 


] 

) 19 4 


! 










I3S 


2 C 

3 N 2 


M .' 
-■".• 

MM 

■ .11 




"... 
PHY 
PLA 
PLP 
PL* 


»*Mi S l-S 
»-M, S !•§ 

S * 1*6 M, - A 
5.1-1 W,-P 
S - 1-5 M, • ■ 












- : 
-.* .1 

- 1 


1 
1 




























M 2 

W V IDI'C 

N 2 


p-y 

nji 
P.I 

r,. 




PL* 
ROL 

ii..t. 

nit 


5 - • • 5 M • V 

- 

.,.. .. 1 

i-i.im 'iri-i intn 

IHhNI l| L1--1 5ij.i 




U 

. ii 

in 


• 
1 


H 


3 6Ap 


■ 

1 

i 
* - 
00* 


l 








■ ■ 


3 
J 


3E B. 

'( B 


1 
1 














N 2 
I. 7 C 
N JC 
N V 1 1 2 C 


ii - 

lit 

fli! 




sec 
sec 

■ED 
IEI 

T. 


t M C ■ A II) 

•■ 

1 *D 

1 -1 


H - 


7 


IB 7 

• B 7 
II 


•: ■ 
1 
1 
1 

y 1 


B 


■ 
1 1 


1 

: 


■ • 1 
95 4 


■ 


■ 1 


1 >'. .1 


1 
■ 










97 •> 


2 C BBC 
I see 

1 1EO 

< in 

7 STA 




SI» 
ST> 

ST7 
IA« 
Tfl. 


• • >.' 

V -M 

00 -W 

A • • 
A -1 




K 

N 


■1 
■1 
■ 


H 
in 
•> 




»«7 


1 
1 








94 4 

'4 4 


i, . 
1 
I 


t, ■ 


1 














1 2 

"" 2 


... 
■ '• 
BI3 
TAA 

TAV 




1»B 
T3B 

'■» 

T4A 

'■', 


. AM-M l.i 
AVM-M |4| 

"•A 

*-A 

• *■ 






1 


14 B 


3 


OA 1 

«A • 

M - 


1 
1 

• 




























7 

2 

V 7 


mi 
m 

'.- 






. •'. 












-- 


1 




























!• 


rv< 





Noiei 
1 
2. 

3, 

■1 

": 



Mi Meuio'v nc' itack pomic 



Arid ) 10 n il paint bounria-v 1* cowwd. x 

Add I 10 "n" il btancn occun 10 lump pjqe V 

Add 2 to """ ll branch occun 10 dillnvni page A 

Add I la "n" il decimal mode M 

V Oil equalt nwmoty bn 6 pno* to eaecudon 

N mi equal 1 mtmory bit 7 pfior to e*pcul<nn 

lb* immedmlo Mldiming mod? o' Ibe BIT imiruction luvn bit) 6 01 7 

IV & N) in iho Piqc'iwf SlBlui Code ReyutPi unchanged. 



A.2 Data Sheet 



lode. X 

lndo« Y 

Accumulate 

Memcv p«" et'ectiveaddiB» 



Add 

Subl'aci 
And 
Or 

Enciunie or 



n No Cyclei 

* No Bviei 
Mg Memcv bn 6 
M7 Memo'v b>t 7 



R^ 



I 



B) 

n 

Q. 



x 



i 



Appendix H explains the general 
rules and tables tor converting 
numbers from one of these forms 
to another. For memory map 
diagrams, refer to Chapter 2. 
Figure 2-2 Is an overall memory 
map, Figure 2-3 is a map of 
bank-switched memory, and 
Figure 2-11 is a map of the 48K 
memory space. 



This appendix lists all important RAM and hardware locations 
in address order and describes them briefly. It also provides 
cross-references to the section of the manual where they are 
described further. Appendix C contains a similar list for 
important firmware addresses. 

The tables in this appendix list addresses in either two or three 
forms: the hexadecimal form (preceded by a dollar sign) for use 
in assembly language; the decimal form for use in Applesoft 
BASIC; and (for numbers greater than 32767) the 
complementary decimal value for use in Apple Integer BASIC. 



l: 



B. 1 Page Zero 



For Monitor zero page usage, refer 
to the firmware listings. For zero 
page use by the languages and 
operating systems, refer to the 
appropriate reference manuals. 



i 

L 



Table B-1 lists the zero page addresses in hexadecimal and 
decimal form, followed by symbols denoting the firmware or 
system software that uses them. 

• M denotes the Monitor. 

• A denotes Applesoft BASIC. 

• I denotes Integer BASIC. 

• D denotes DOS. 

• P denotes ProDOS. Locations whose contents ProDOS 
saves and restores afterward have a P in parentheses, 
indicating that ProDOS has no net effect on them. 



B.1 Page Zero 



15 



Table B-1. Zero Page Use 



Hex 

soo 

S01 

S02 

$03 

S04 

S05 

$06 

$07 

S08 

$09 

SOA 

$0B 

$0C 

SOD 

$OE 

$0F 

$10 

$11 

$12 

$13 

$14 

$15 

$16 

$17 

$18 

$19 

S1A 

$1B 

S1C 

$1D 

S1E 

$1F 

$20 

$21 

$22 

$23 

$24 

$25 

$26 

$27 

$28 

$29 

$2A 

$2B 

$2C 

$2D 

$2E 

$2F 



Dec 


1 
2 
3 
4 
5 
B 
7 
S 
9 

10 

11 

12 

13 

14 

15 

16 
17 

IB 

19 

20 

21 

22 

23 

24 

25 

26 

27 

28 

29 

30 

31 

32 

33 

34 

35 

36 

37 

38 

39 

40 

41 

42 

43 

44 

45 

46 

47 



Used by 

A 

A 
A 
A 
A 

A 



A 
A 
A 
A 

A 

A 

A 
A 

A 

A 

A 
A 
A 

A 
A 



M 

M 

M 
M 

M 
M 

M 

N' 

M 

M 
M 
M 

M 

M 

u 
M 



Hex 

$30 

$31 

$32 

S33 

$34 

S35 

$36 

$37 

$38 

$39 

S3A 

$3B 

$3C 

S3D 

$3E 

$3F 

$40 

$41 

$42 

$43 

$44 

$45 

$46 

$47 

$48 

$49 

$4A 

$4B 

$4C 

$4D 

$4E 

S4F 

$50 

$51 

$52 

$53 

$54 

$55 

$56 

$57 

$58 

$59 

$5A 

$5B 

$5C 

$5D 

$5E 

$5F 



Dec 

48 

49 

50 

51 

52 

53 

54 

55 

56 

57 

58 

59 

60 

61 

62 

63 

64 
65 
66 
67 
Bfl 
69 

;o 

71 

72 
73 
74 
75 
76 
77 
78 
79 



81 

B2 

83 
B4 
B5 

86 
87 
88 
89 
90 

91 
92 
93 
94 
95 



Used by 

\1 
M 
M 

N* 

M 

M 
M 

M 

M 
M 
M 
M 

M 
M 
M 

M 

M 

M 

M 
M 
M 
M 

M 

M 

M 

M 



M 

r,i 

M A 

M A 

M A 

M A 

M A 

M A 

A 

A 

A 

A 

A 

A 

A 

A 
A 
A 



D (P) 
D (P) 
D (P) 

D (P) 
D (P) 
D (P> 
D (P) 
D (P) 
D (P) 

(P) 
D (P> 
D (P) 
D (P) 
D (P) 

(P) 



i 

i 

'A 
■J 

I 

i 



,\ 



j. 



l6l 



Appendix B: Memory Map 



















g- _j§ 


















raftfe fl-r— Continued. Zero Page Use 










fc« 


Hex 


Dec 


Used by 


Hex 


Dec 


Used by 






S60 


96 


A I 


S90 


144 


A I 






S61 


9; 


A I 


S91 


145 


A I 




r" 


S62 


98 


A 1 


S92 


146 


A I 




S63 


99 


A 1 


S93 


147 


A I 






S64 


100 


A 1 


$94 


148 


A I 






S65 


101 


A 1 


$95 


149 


A I 




M 


S66 


102 


A 1 


$96 


150 


A I 




S67 


103 


A 1 D 


$97 


151 


A I 






S68 


104 


A 1 D 


$98 


152 


A I 






S69 


105 


A 1 D 


$99 


153 


A I 




j^ 


S6A 


106 


A 1 D 


$9A 


154 


A I 




S6B 


107 


A t 


S9B 


155 


A I 






S6C 


108 


A 1 


$9C 


156 


A I 






S6D 


109 


A 1 


$9D 


157 


A I 




P 


S6E 


110 


A 1 


$9E 


158 


A I 




$6F 


111 


A 1 D 


$9F 


159 


A I 






S70 


112 


A 1 D 


$A0 


160 


A I 




1' , 


$71 


113 


A I 


SA1 


161 


A I 




■ 


$72 


114 


A 1 


$A2 


162 


A I 






$73 


115 


A 1 


$A3 


163 


A I 






$74 


116 


A 1 


$A4 


164 


A I 




tg 


$75 


117 


A 1 


SA5 


165 


A I 




$76 


118 


A 1 


$A6 


166 


A I 






$77 


119 


A 1 


$A7 


167 


A I 






$78 


120 


A 1 


SA8 


168 


A I 




N 


$79 


121 


A 1 


SA9 


169 


A t 




$7A 


122 


A 1 


SAA 


170 


A I 






$7B 


123 


A 1 


$AB 


171 


A I 






S7C 


124 


A 1 


$AC 


172 


A I 




Srs 


$7D 


125 


A 1 


$AD 


173 


A I 




■ ug 


$7E 


126 


A 1 


$AE 


174 


A I 






$7F 


127 


A 1 


$AF 


175 


A I D 




* 


$80 


128 


A 1 


SBO 


176 


A I D 




■ 


$81 


129 


A I 


$B1 


177 


A I 






$82 


130 


A 1 


$B2 


178 


A I 






$83 


131 


A 1 


$B3 


179 


A I 




hi 


$84 


132 


A 1 


$B4 


180 


A I 




$85 


133 


A 1 


$B5 


181 


A I 




1 — 


$86 


134 


A 1 


$B6 


182 


A I 






$87 


135 


A 1 


$B7 


183 


A I 




1— - 


S86 


136 


A 1 


$B8 


184 


A I 




■ 


S89 


137 


A 1 


$B9 


185 


A I 






S8A 


138 


A 1 


$BA 


186 


A I 






$8B 


139 


A 1 


SBB 


187 


A I 




*■ 


$8C 


140 


A 1 


$BC 


188 


A I 




H ,J 


$8D 


141 


A 1 


SBD 


189 


A I 




* - ™ 


$8E 


142 


A 1 


$BE 


190 


A I 






$8F 


143 


A 1 


$BF 


191 


A I 




1— aji 
















r 


B.1 


Page Zero 










1 17 



Table B-1 — Continued- Zero Page Use 



Hex 



Dec Used by 



Hex 



Dec 



Used by 



SCO 


192 


A I 


SEO 


224 


A 


SCI 


193 


A I 


SE1 


225 


A 


SC2 


194 


A I 


SE2 


226 


A 


SC3 


195 


A I 


SE3 


227 




SC4 


196 


A I 


$E4 


228 


A 


SC5 


197 


A I 


SE5 


229 


A 


SC6 


198 


A I 


SE6 


230 


A 


SC7 


199 


A I 


SE7 


231 


A 


SC8 


200 


A I 


SE8 


232 


A 


SC9 


201 


A I 


SE9 


233 


A 


SCA 


202 


A I D 


SEA 


234 


A 


SCB 


203 


A I D 


SEB 


235 




see 


204 


A I D 


SEC 


236 




SCD 


205 


A I D 


SED 


237 




SCE 


206 


I 


SEE 


238 




SCF 


207 


I 


SEF 


239 




SDO 


208 


A I 


SFO 


240 


A 


SD1 


209 


A I 


SF1 


241 


A 


SD2 


210 


A I 


SF2 


242 


A 


SD3 


211 


A I 


SF3 


243 


A 


SD4 


212 


A I 


SF4 


244 


A 


SD5 


213 


A I 


SF5 


245 


A 


SD6 


214 


I 


5F6 


246 


A 


SD7 


215 


I 


SF7 


247 


A 


SD8 


216 


A I D 


SF8 


248 


A 


SD9 


217 


A I 


SF9 


249 




SDA 


218 


A I 


SFA 


250 




$DB 


219 


A I 


SFB 


251 




SDC 


220 


A I 


SFC 


252 




SDD 


221 


A I 


SFD 


253 




$DE 


222 


A I 


SFE 


254 




SDF 


223 


A I 


SFF 


255 





I*- 



ULe 



! 



18 



Appendix B: Memory Map 



I 



B.2 Page Three 



Most of page 3 is available for small machine-language 
programs or any other use your program might put it to. The 
built-in Monitor uses the top sixteen addresses of page 3. as 
shown in Table B-2; the XFER routine (section 2.5.3) uses 
locations S3ED and S3EE. If you are using DOS or ProDOS, it 
also uses the 32 locations S3D0 through $3EF. 



Use 

Address ol BRK request handler 
(normally $59. SFA) 

Reset vector 

Power-up byte (see text) 

Jump instruction to Applesoft 
&-command handler 
(initially S4C. S58. SFF) 

Jump instruction to user CONTROL-Y 
command handler 



Table B-2. Page 


3 Use 


Hex 


Dec 


Section 


S3F0 
S3F1 


1008 
1009 


2.6.4 


S3F2 
S3F3 
S3F4 


1010 
1011 
1012 


2.6.4 & 

10.1 

2.64 


S3F5 
S3F6 
S3F7 


1013 
1014 
1015 




S3F8 
S3F9 
S3FA 


1016 
1017 
1018 


10.6.4 


S3FB 
S3FC 
S3FD 


1019 
1020 
1021 




S3FE 
S3FF 


1022 
1023 


2.6.4 



=3 



Jump instruction to NMl interrupt 
handler (not used by Apple lie) 



Address ot user IRQ interrupt handler 



B.2 Page Three 



fig" 



B. 3 Screen Holes 



One result of the way the Apple He hardware maps display 
memory on the screen is that groups of eight memory 
addresses are left over in sixteen areas of the text and 
low-resolution display pages — eight areas in main RAM and 
eight in auxiliary RAM. The firmware uses for these 128 bytes 
are shown in Tables B-3 and B-4, with cross-references to the 
section numbers where they are described. 

Table B-3. Mam Memory Screen Hole Allocations 



14- 



Hex 


Dec 


Section 


Description 


S478 


1144 


9.1.5 


Mouse port: low byte ol clamping 
minimum 


S479 


1145 


7.5 


Reserved (or serial port 1 


S47A 


1146 


8.5 


Reserved tor serial port 2 


S47B 


1147 




Reserved 


S47C 


1148 


9.1.5 


Low byte of X coordinate 


S47D 


1149 




Reserved for mouse port 


S47E 


1150 




Reserved 


S47F 


1151 




Reserved 


S4F8 


1272 


9.1.5 


Mouse port: low byte of clamping 
maximum 


S4F9 


1273 


7.5.E.6.3 


Reserved for serial port 1 


S4FA 


1274 


8.5.E.6.2 


Reserved for serial port 2 


S4FB 


1275 




Reserved 


S4FC 


1276 


9.1.5 


Low byte of Y coordinate 


S4FD 


1277 




Reserved for mouse port 


S4FE 


1278 




Reserved 


S4FF 


1279 


E.6.4 


Reserved 


S57B 


1400 


9.1.5 


Mouse port: high byte of clamping 
minimum 


S579 


1401 


7.5 


Port 1 printer width (1-255; 
= unlimited) 


S57A 


1402 


8.5 


Port 2 line length {1-255; 
= unlimited) 


S57B 


1403 




Cursor horizontal position (80-column 
display) 


S57C 


1404 


9.1.5 


High byte of X coordinate 


S57D 


1405 




Reserved for mouse port 


S57E 


1406 




Reserved 


S57F 


1407 


E.6.4 


Reserved 


S5F8 


1528 


91.5 


Mouse port: high byte of clamping 
maximum 


S5F9 


1529 


7.5.E.6.3 


Port 1 temporary storage location 


S5FA 


1530 


8.5.E.6.2 


Port 2 temporary storage location 


S5FB 


1531 




Reserved 


S5FC 


1532 


9.1.5 


High byte of Y coordinate 


S5FD 


1533 




Reserved tor mouse port 


S5FE 


1534 




Reserved 


S5FF 


1535 


E.6.2 


Reserved 



I I 

,! 

H 



~20l 



Appendix B: Memory Map 



Table B-3—Continued. Mam Memory Screen Hole Allocations 



l: 



-l 

^5 



Hex 


Dec 


Section 


Description 


S678 


1656 




Reserved 


S679 


1657 


7.5 


Indicates when port 1 firmware is 
parsing a command 


S67A 


1658 


8.5 


Indicates when port 2 lirmware is 
parsing a command 


S67B 


1659 




Reserved 


S67C 


1660 


9.1.5 


Mouse port: reserved 


S67D 


1661 




Reserved for mouse port 


S67E 


1662 




Reserved 


S67F 


1663 


E.6.4 


Reserved 


S6F8 


1784 




Reserved 


S6F9 


1785 


7.5 


Current port 1 command character 


S6FA 


1786 


8.5 


Current port 2 command character 


S6FB 


1787 




Reserved 


S6FC 


1788 


9.1.5 


Mouse port: reserved 


S6FD 


1789 




Reserved tor mouse port 


S6FE 


1790 




Reserved 


S6FF 


1791 


E.6.2 


Reserved 


S778 


1912 




DEVNO: SnO current active port 
number x 16 


S779 


1913 


7.5 


Port 1 Hags for echo and auto line 
teed 


S77A 


1914 


B.5 


Port 2 tlags for echo and auto line 
feed 


S77B 


1915 




Reserved 


S77C 


1916 


9.1.5.E.6.1 


Mouse port status byte 


S77D 


1917 




Reserved for mouse port 


S77E 


1918 




Reserved 


S77F 


1919 




Reserved 


S7F8 


2040 




MSLOT: owner of SC800-SCFFF <$C3 
video) 


S7F9 


2041 


7.5 


Port 1 current printer column 


S7FA 


2042 


8.5 


Port 2 current line position 


S7FB 


2043 




Reserved 


S7FC 


2044 


9.1.5 


Mouse port mode byte 


S7FD 


2045 




Reserved for mouse port 


S7FE 


2046 




Reserved 


S7FF 


2047 




Reserved 



E 



t5 



B.3 Screen Holes 



\2T 



Table B-4 


. Auxiliary Memory Screen Hole Allocations 


Hex 


Dec 


Section 


Description 


$478 


1144 


7.5 


Initial port 1 ACIA Control Register 
values ($9E) 


S479 


1145 


7.5 


Initial port 1 ACIA Command Register 
values (SOB) 


S47A 


1146 


7.5 


Initial port 1 characteristics flags ($40) 


$47B 


1147 


7.5 


Initial port 1 printer width ($50) 


S47C 


1148 


8.5 


Initial port 2 ACIA Control Register 
values ($16) 


S47D 


1149 


8.5 


Initial port 2 ACIA Command Register 
values (SOB) 


S47E 


1150 


8.5 


Initial port 2 characteristics Hags (S01) 


S47F 


1151 


8.5 


Initial port 2 line length ($00) 


$4F8 


1272 






through 






Reserved 


S4FF 


1279 






S578 


1400 






through 






Reserved 


$57F 


1407 






S5F8 


1528 






through 






Reserved 


S5FF 


1535 






$678 


1656 






through 






Reserved 


$67 F 


1663 






$6F8 


1784 






through 






Reserved 


$6FF 


1791 






$778 


1912 






through 






Reserved 


$77F 


1919 






$7F8 


2040 






through 






Reserved 


S7FF 


2047 







*- 

£ 

£ 

£ 
£ 



a 

hi 



22 



Appendix B: Memory Map 



£ 



L 

i 



I BA The Hardware Page 

3 



t 

l: 

■ 

i 

■ 

i 

■ 

i 

i 



Tables B-5 through B-9 list all the hardware locations available 
for use in the Apple lie. These tables have a column at the left 
that is not present in other tables. This column, labeled RW, 
indicates the action to take at a particular location. 

• R means read. 

• RR means read twice in succession. 

— • R7 means read the byte and then check bit 7; in the use 

r*j column, "see if..." refers to the condition represented by 

bit 7 = 1, unless otherwise specified. Bit 7 has a value 
of $80, so if the contents of the location are greater than or 
equal to S80. the bit is on. 

Another way to test bit 7 (the sign bit) is with a BIT 
*"!} instruction, followed by BPL {bit 7 was 0) or BMI (bit 7 

— was 1). 

— • R/W means to either read or write. For writing, the value is 

unimportant. 



3 



• W means to write only. The value is unimportant, 
r* • N means not to read or write, because the location is 



■ 

I! 

■ 

L 



reserved. 

An address of the form SCOOx means the sixteen locations from 
SC000 through SC00F. Labels, when they are shown, are simply 
memory aids. Some of them correspond to the labels at those 
addresses in the firmware, others do not. Your program will 
have to assign a label for it anyway. 



B.4 The Hardware Page f23~ 



Table B-5. Addresses SCOOO Through SC03F 
RW Hex Dec Neg Dec Label 



R 

W 
W 

w 
w 
w 

v; 
W 

w 
w 
w 

w 
w 
w 
w 
w 
w 

w 

R7 

R7 

R7 

R7 

R7 

R 

R7 

R 

R7 

R7 

R7 

R7 

R7 

R7 

R7 

R7 

\: 



SCOOx 






SCOOO 


49152 


-16384 


SC0O1 


49153 


-16383 


SC002 


49154 


-16382 


SC003 


49155 


-16381 


SC004 


49156 


-16380 


SC005 


49157 


-16379 


SC006 


49158 


-1637B 


SC007 


49159 


-16377 


SC008 


49160 


-16376 


5C009 


49161 


-16375 


SCOOA 


49162 


-16374 


SCOOB 


49163 


-16373 


SCOOC 


49164 


-16372 


SCOOD 


49165 


-16371 


SCOOE 


49166 


-16270 


SCOOF 


49167 


-16369 


SCOlx 






SC010 


49168 


-16368 


scon 


49169 


-16367 


SC0 12 


49170 


-16366 


SC0 13 


49171 


-16365 


SC0 14 


49172 


-16364 


SC0 15 


49173 


-16363 


SC0 16 


49174 


-16362 


SC017 


49175 


-16361 


SC0 18 


49176 


-16360 


SC019 


49177 


-16359 


SC01A 


49178 


-16358 


SC01B 


49179 


-16357 


SCOIC 


49180 


-16356 


SC01D 


49181 


-16355 


SC01E 


49182 


-16354 


SC01F 


49183 


-16353 



SC020 

through 
SC02F 

SC030 
SC030 

SC031 

through 

SC03F 



49184 
49199 

49200 
49200 

49201 
49215 



t Also section 2.5.4 



-16352 

-16337 

-16336 
-16336 

-16335 
-16321 



KSTRB 

80STORE 

80STORE 

RAMRD 
RAMRD 
RAMWRT 
RAMWRT 



ALT2P 
ALTZP 



80COL 
80COL 
ALTCHAR 
ALTCHAR 



AKD 

RDBNK2 

RDLCRAM 

RDRAMRD 

RDRAMWRT 

RSTXINT 

RDALTZP 

RSTYINT 

RD80STORE 

RSTVBL 

RDTEXT 

RDMIX 

RDPAGE2 

RDHIRES 

RDALTCHAR 

RD80COL 



Section 

4.1 

5.6t 

5.6t 

2.5.2 

2.5.2 

2.5.2 

25.2 



2.4.2 
2.4.2 



5.6 
5.6 
5.6 
5.6 

4.1 

4.1 

2.4.2 

2.4.2 

2.5.2 

2.5.2 

9.1.3 

2.4.2 

9.1.3 

5.6t 

9.13 

5.6 

5.6 

5.6t 

56t 

5.6 

5.6 



4.2.1 



Use 

Read keyboard data (bits 0-6) and strobe (bit 7) 

Olf: PAGE2 switches Page 1 and 2 

On: PAGE2 switches Page 1 and 1X 

Of!: read main 48K RAM 

On: read auxiliary 48K RAM 

Olf: write in main 48K RAM 

On: write in auxiliary 48K RAM 

Reserved 

Reserved 

Off- use main PO. PL bank-switched RAM 

On: use auxiliary PO, PI. bank-switched RAM 

Reserved 

Reserved 

Off: 40-column display 

On: 80-column display 

OH: display primary character set 

On: display alternate character set 

Clear keyboard strobe (SCOOx bit 7) 

See if any key now down; clear strobe 

See if using SD000 bank 2 (or 1) 

See if reading RAM (or ROM). 

See if reading auxiliary 48K RAM (or main) 

See if writing auxiliary 48K RAM (or main) 

Reset mouse X0 interrupt. ..-*.■ 

See if auxiliary PO, P1 and bank-switched RAM 

Reset mouse Y interrupt 

See it 80STORE on (or off) 

See if VBL1NT oil (1); reset it 

See if text (or graphics) 

See if mixed mode switch on 

See if page 2/1X selected (or 1) 

See if high-resolution switch on 

See if alternate character set (or primary) 

See If 80-column hardware on 



Reserved (read and write) 

Reserved 
Toggle speaker 

Reserved (read and write) 



j 

a 



^ 



- 



"241 



Appendix B: Memory Map 



h 


















Ta/j/e S-5. Addresses SC040 Through SC05F 






ba 


RW 


Hex 


Dec 


Neg Dec 


Label 


Section 


Use 


1 


R7 


$C040 


49216 


-16320 


RDXYMSK 


9.1.3 


See if XO/YO mask set 


l 


R7 


SC041 


49217 


-16319 


RDVBLMSK 


9.1.3 


See if VBL mask set 


|=a 


R7 


SC042 


49218 


-16318 


RDXOEDGE 


9.1.3 


See if interrupt on falling XO edge 


R7 


SC043 


49219 


-16317 


RDYOEDGE 


9.1.3 


See if interrupt on falling YO edge 




N 


SC044 


49220 


-16316 






Reserved 


L 


N 


SC045 


49221 


-16315 






Reserved 




N 


SC046 


49222 


-16314 






Reserved 


N 


SC047 


49223 


-16313 






Reserved 




R 


SC048 


49224 


-16312 


RSTXY 


9.1.3 


Reset XO/YO interrupt flags 




N 


SC049 


49225 


-16311 






Reserved 


™— 


N 


SC04A 


49226 


-16310 






Reserved 


™" .2 


N 


SC04B 


49227 


-16309 






Reserved 




N 


SC04C 


49228 


-16308 






Reserved 




N 


SC04D 


49229 


-16307 






Reserved 


■— * 


N 


SC04E 


49230 


-16306 






Reserved 


N 


SC04F 


49231 


-16305 






Reserved 




RAW 


SC050 


49232 


-16304 


TEXT 


5.6 


Oft: graphics display 


1 


R/W 


$C051 


49233 


-16303 


TEXT 


5.6 


On: text display 


■""* 


R/W 


SC052 


49234 


-16302 


MIXED 


5.6 


Off: text or graphics only 




R/W 


SC053 


49235 


-16301 


MIXED 


5.6 


On: combination text and graphics 




R/W 


SC054 


49236 


-16300 


PAGE2 


5.6 T 


Off: use page 1 


F 


R/W 


SC055 


49237 


-16299 


PAGE2 


5.6f 


On: display page 2 (80STORE off); store to 


!""* 














page 1X (80STORE on) 




R/W 


SC056 


49238 


-16298 


HIRES 


5.6t 


Off: low-resolution 




R/W 


SC057 


49239 


-16297 


HIRES 


5.6t 


On: high-resolution; double if 80COL and 


i 














DHIRES on 


J-r4 


N 


SC058 


49240 


-16296 






Reserved if IOUDIS on (SC07E bit 7-1) 




R/W 








DISXY 


9.1.3 


Disable (mask) mouse X0/Y0 interrupts 




N 


SC059 


49241 


-16295 






Reserved if IOUDIS on 


fci 


R/W 








ENBXY 


9.1.3 


Enable (allow) mouse X0/Y0 interrupts 


N 


SC05A 


49242 


-16294 






Reserved if IOUDIS on 




R/W 








DISVBL 


9.1.3 


Disable (mask) VBL interrupts 




N 


SC05B 


49243 


-16293 






Reserved If IOUDIS on 


^^« 


RAW 








ENVBL 


9.1.3 


Enable (allow) VBL interrupts 


M '__fc 


N 


SC05C 


49244 


-16292 






Reserved if IOUDIS on 




R/W 








XOEDGE 


9.1.3 


Interrupt on rising edge of X0 




N 


SC05D 


49245 


-16291 






Reserved if IOUDIS on 


■ 


R W 








X0EDGE 


9.1.3 


Interrupt on falling edge of X0 


"■ A 


R/W 


$C05E 


49246 


-16290 


DHIRES 


5.6 


If IOUDIS on: set double-high-resolution 


"~ 


R/W 








YOEDGE 


9.1.3 


If IOUDIS off: interrupt on rising Y0 




R/W 


SC05F 


49247 


-16289 


DHIRES 


5.6 


If IOUDIS on: clear double-high-resolution 


' 


R/W 








YOEDGE 


9.1.3 


If IOUDIS oft: interrupt on falling Y0 


B. iA 
















1 


t Also section 2.5.4. 










L 
















3 
































h 
















I - 
















r 
























B.4 The Hardware Page 


IS" 



Table B-7. Addresses SC060 Through SC07F 




RW 


Hex 


Dec 


Neg Dec 


Label 


Section 


W 

R7 

R7 

R7 

R7 

R7 

R7 

R7 

R7 


SC06x 
SC060 
SC061 
SC062 
SC063 
SC064 
SC065 
SC066 
SC067 


49248 
49249 
49250 
49251 
49252 
49253 
49254 
49255 


-16288 
-16287 
-16286 
-16285 
-16284 
-16283 
-16282 
-16281 


RD80SW 

RDBTNO 

RDBTN1 

RD63 

POLO 

PDL1 

MOUX1 

MOUY1 


4.1 

9.1. 3t 

9.2t 

9.1.9.2 

9.2 

9.2 

91.3 

9.1.3 


N 

N 


SC068 

through 

SC06F 


49256 
49263 


-16280 
-16273 






R/W 


SC07x 










R/W 


SC070 


49264 


-16272 


PTRIG 


9.2 


N 
N 


SC071 

through 

SC07D 


49265 
49277 


-16271 
-16259 






R7 


SC07E 


49278 


-16258 


RDIOUDIS 




W 








IOUDIS 


5.6,9.1.3 


R7 

W 


SC07F 


49279 


-16257 


RDDHIRES 

IOUDIS 


5.6.9.1.3 
5.6 


t Also section 4.1 









Use 

Reserved (write) 

See if 80/40 switch down (= 40) 
See i! switch or ( a 1 pressed 
See if switch 1 or| ■ | pressed 
See if mouse button not pressed 
See if hand control button pressed 
See tf hand control button 1 pressed 
See if mouse X1 (direction) is high 
See if mouse Y1 (direction) is high 



Reserved (write and read) 

Trigger paddle timer; reset VBLINT; however, 
some $C07x are reserved 
Designated trigger or reset location 

Reserved 



See if IOUDIS on; trigger paddle timer; reset 

VBLINT 

On; enable access to DHIRES switch; disable 

SC058-SC05F IOU access 

See if DHIRES on 

Off: disable access to DHIRES switch: enable 

SC058-SC05F IOU access 






~k\ 



Appendix B; Memory Map 



6 



I 



l: 



-4 



I 



-14 



i 

h 



fobfe fl-fl. Addresses SC080 Through SCOAF 



RW Hex 



R 

RR 

R 

RR 

N 

N 

N 

N 

R 

RR 

R 

RR 

N 

N 

N 

N 

r . 

N 

R/W 
R/W 
R/W 



SC080 
SC081 
SC082 
SC083 
SC084 
SC085 
SC086 
SC087 
SC088 
SC089 
SC08A 
SC08B 
SC08C 
SC08D 
SC08E 
SC08F 

SC090 

through 

SC097 

SC098 
SC099 
SC09A 



R/W SC09B 
N 

N 



SC09C 

through 

SC09F 



SCOAO 

through 

SC0A7 



R/W SC0A8 

R/W SC0A9 

R/W SCOAA 

R/W SCOAB 

N SCOAC 
through 

N SCOAF 



Dec 


Neg Dec Label 


49280 


-16256 


49281 


-16255 


49282 


-16254 


49283 


-16253 


49284 


-16252 


49285 


-16251 


49286 


-16250 


49287 


-16249 


49288 


-16248 


49289 


-16247 


49290 


-16246 


49291 


-16245 


49292 


-16244 


49293 


-16243 


49294 


-16242 


19295 


-16241 



49296 



:-.■,.-- 



■16240 



■16233 



49304 
49305 
49306 


-16232 

-16231 
-16230 


49307 


-16229 


49308 


-16228 


49311 


-16225 


49312 


-16224 


49319 


-16217 


49320 
49321 
49322 


-16216 
-16215 

-16214 


49323 


-16213 


49324 


-16212 


49327 


-16209 



Section 

2.4.2 
2.4.2 

2.4.2 
2.4.2 



2.4.2 
2.4.2 
2.4.2 
2.4.2 



7.3, 11.11 
7.3. 11.11 
7.3, 11.11, 
Appendix E 
7.3. 11.11 



8.3, 1111 
8.3. 11.11 
8.3. 11.11, 
Appendix E 
8.3, 11.11 



B.4 The Hardware Page 



Use 

Read RAM; no write; use SD000 Dank 2 

Read ROM, write RAM; use SD000 bank 2 

Read ROM; no write; use SD000 bank 2 

Read and write RAM; use SD000 bank 2 

Reserved 

Reserved 

Reserved 

Reserved 

Read RAM. no write; use SD000 bank 1 

Read ROM. write RAM; use SD000 bank 1 

Read ROM; no write; use SD000 bank 1 

Read and write RAM, use SD000 bank 1 

Reserved 

Reserved 

Reserved 

Reserved 



Reserved 

Port 1 ACIA Transmit/receive register 
Port 1 ACIA Status register 
Port 1 ACIA Command register 

Port 1 ACIA Control register 
Reserved 

Reserved 



Port 2 ACIA Transmit/receive register 
Port 2 ACIA Status register 
Port 2 ACIA Command register 

Port 2 ACIA Control register 



Reserved 



\zF 



Table B-9. Addresses SCOBO Through SCOFF 


RW 


Hex 


Dec 


Neg Dec Label 


N 

N 


SCOBO 

through 

SCOBF 


49328 
49343 


-16208 
-16193 


N 
N 


SCOCO 

through 

SCOCF 


49344 
49359 


-16192 
-16177 


N 
N 


SCODO 

through 

SCODF 


49360 
49375 


-16176 
-16161 


N 
N 


SCOEO 

through 

SCOEF 


49376 
49391 


-16160 
-16145 


N 
N 


SCOFO 

through 

SCOFF 


49392 
49407 


-16144 
-16129 



Section 



Use 

Reserved 

Reserved 

Reserved 
Reserved 

Reserved 



28 l 



Appendix B: Memory Map 






L 



l: 



I 



t 



I 



I 

■ -J 

LI 

E 

L 



0) 
"O 

o 

Q 
X 

o 



This appendix lists all significant firmware addresses: entry 
points, locations containing the addresses of entry points, and 
locations where machine and device identification bytes reside. 

Warning 

The Monitor firmware entry points are the only published entry 
points in the sense that they are the only ones that will remain 
in the same locations in future Apple II series computers. 

The firmware protocol identification bytes and offsets will work 
with other Apple II series computers only if used as directed 
(section 3.4.2). 



C. 1 The Tables 



■—a 



Appendix H contains tables and 
examples ol the derivation of each 
form of address from either of the 
other forms. 



This appendix supplements the chapter text by specifying three 
forms of each address: hexadecimal, decimal, and 
complementary (negative) decimal. 

In these tables, some of the addresses are followed by a label 
of the location. These labels are listed only to assist you in 
finding the named location in the firmware listings, or in 
remembering the function found at the address. The Apple lie 
contains no global label table: your program must assign its 
own labels to the addresses as required. 

There are several types of information at these firmware 
addresses: actual entry points (labeled entry), the low-order byte 
of an entry point (labeled offset), a device or machine 



C.1 The Tables 



laT 



identification byte (labeled ident). indicators (labeled indie) 
specifying whether there are optional routines, vector addresses 
(labeled vector), and an RTS instruction location. 

The column labeled Section contains the number of the section 
that describes the item. If there is no description except in a 
table in this appendix, a section number is not listed. 

Each input/output port has an associated protocol table, as 
shown in Tables C-1 through C-4. Many of the bytes (labeled 
offset) in the protocol tables are the low-order bytes of 
addresses of I/O routines for the ports; the high-order byte of 
these addresses must be $Cn (where n is the port number). 
This structure is explained in Chapter 3. Although your program 
must perform some extra processing to use these tables, the 
benefit is simplified compatible port and slot I/O for all Apple II 
series machines. 



C.2 Port Addresses 



Table C-1. Serial Port l Addresses 



Hex 



Dec 



Neg Dec Label 



SC100 


49408 


-16128 


SC105 


49413 


-16123 


SC107 


49415 


-16121 


SC10B 


49419 


-16117 


scioc 


49420 


-16116 


SC10D 


49421 


-16115 


SC10E 


49422 


-16114 


$C10F 


49423 


-16113 


SC110 


49424 


-16112 


SC1 11 


49425 


-16111 



Type 


Section 


Description 


entry 


3.1.1 


Main port 1 entry point 


ident 


3.4.2 


ID byte (S38) 


ident 


3.4.2 


ID byte ($18) 


ident 


3.4.2 


Firmware card signature (SOI) 


ident 


3.4.2 


Super Serial Card ID ($31) 


offset 


7.4 


Low-order PINIT address 


offset 


7.4 


Low-order PREAD address 


offset 


7.4 


Low-order PWRITE address 


offset 


7.4 


Low-order PSTATUS address 


indie 


3.42 


Non-zero: no optional routines 



Table C-2. Serial Port 2 Addresses 



Hex 



Dec 



Neg Dec Label 



SC200 


49664 


-15872 


SC205 


49669 


-15867 


SC207 


49671 


-15865 


SC20B 


49675 


-15861 


SC20C 


49676 


-15860 


SC20D 


49677 


-15859 


SC20E 


49678 


-15858 


SC20F 


49679 


-15857 


SC210 


49680 


-15856 


SC211 


49681 


-15855 



Type 


Section 


Description 


entry 


3.1.1 


Main port 2 entry point 


ident 


3.4.2 


ID byte ($38) 


tdent 


3.4.2 


ID byte ($18) 


ident 


3.4.2 


Firmware card ID ($01) 


ident 


3.4.2 


Super Serial Card ID ($31) 


offset 


8.4 


Low-order PINIT address 


offset 


8.4 


Low-order PREAD address 


offset 


84 


Low-order PWRITE address 


offset 


8.4 


Low-order PSTATUS address 


indie 


3.4.2 


Non-zero: no optional routines 






~32l 



Appendix C: Important Firmware Locations 



a 



Table C-3. Video Firmware Addresses 



t 



• X 



E 



Hex 


Dec 


Neg Dec 


Label 


SC300 


49920 


-15616 




SC305 


49925 


-15611 


C3KEYIN 


SC307 


49927 


-15609 


C3COUT1 


$C30B 


49931 


-15605 




SC30C 


49932 


-15604 




SC30D 


49933 


-15603 




SC30E 


49934 


-15602 




SC30F 


49935 


-15601 




SC310 


49936 


-15600 




SC311 


49937 


-15599 


MOVEAUX 



Table C-4. Mouse Port Addresses 



Hex 

SC400 
SC405 
SC407 
SC40B 
SC40C 
SC40D 
SC40E 
SC40F 
SC410 
SC411 
SC412 
SC413 
SC414 
SC415 
SC416 
SC417 
SC418 
SC419 



Dec 

50176 
50181 
50183 
50187 
50188 
50189 
50190 
50191 
50192 
50193 
50194 
50195 
50196 
50197 
50198 
50199 
50200 
50201 



Neg Dec Label 



-15360 
-15355 
-15353 
-15349 
-15348 
-15347 
-15346 
-15345 
-15344 
-15343 
-15342 
-15341 
-15340 
-15339 
-15338 
-15337 
-15336 
-15335 



SETMOUSE 

SERVEMOUSE 

READMOUSE 

CLEARMOUSE 

POSMOUSE 

CLAMPMOUSE 

HOMEMOUSE 

INITMOUSE 



Type 


Section 


Description 


entry 


3.1.1 


Main video entry point (output only) 


ident 


3.4.2 


ID byte (S38) 


Ident 


3.4.2 


ID byte (S18) 


idenl 


3.4.2 


Firmware card signature ($01) 


ident 


3.4.2 


80-column card ID ($88) 


offset 


5.9 


Low-order PINIT address 


offset 


5.9 


Low-order PREAD address 


offset 


5.9 


Low-order PWRITE address 


offset 


5.9 


Low-order PSTATUS address 


entry 


2.5.3 


Routine for main/auxiliary control 
swapping (Also called AUXMOVE) 



Type Section Description 

entry Main mouse entry point 

ident 3.4.2 ID byte (S38) 

ident 3.4.2 IDbyte(S18) 

ident 3.4.2 Firmware card signature ($01) 

type 3.4.2 X-Y pointing device ID (S20) 

offset 9.1.4 Low-order PINIT address 

offset 9.1.4 Low-order PREAD address 

offset 9.1.4 Low-order PWRITE address 

offset 9.1.4 Low-order PSTATUS address 

indie 3.4.2 Optional routines follow (S00) 

offset 9.1.4 Low-order SETMOUSE address 

offset 9.1.4 Low-order SERVEMOUSE address 

offset 9.1.4 Low-order READMOUSE address 

offset 9.1.4 Low-order CLEARMOUSE address 

offset 9.1.4 Low-order POSMOUSE address 

offset 9.1 .4 Low-order CLAMPMOUSE address 

offset 9.1.4 Low-order HOMEMOUSE address 

offset 9.1.4 Low-order INITMOUSE address 



C.2 Port Addresses 



I C.3 Other Video and I/O Firmware Addresses 

Miscellaneous firmware addresses are listed in Table C-5. 

Table C-5. Apple He Enhanced Video and Miscellaneous Firmware 

Hex Dec Neg Dec Label Type Section Description 

entry 6.1 Disk drive firmware entry point 

entry 6.2 External disk startup routine 

NEWIRQ entry E.1 IRQ handling routine 



SC600 


50688 


-14848 


SC700 


50944 


-14592 


SC803 


51203 


-14333 



C.4 Applesoft BASIC Interpreter Addresses 



The addresses of Applesoft BASIC entry points are listed in the 
Applesoft BASIC Programmer's Reference Manual. The 
Applesoft interpreter occupies ROM addresses from SDOO0 
through $F7FF. 



C.5 Monitor Addresses 



Table C-6 lists the Monitor entry points, machine identifier 
bytes, interrupt vectors, and the address of a known RTS 
instruction. 



- 



j 

1 



34 I Appendix C: Important Firmware Locations 



L 

1 


7>Wtf C-6 


Apple lie Monitor Entry Points and Vec 


1 


Hex 


Dec 


Neg Dec 


Label 


1 ~ 


SF800 


63488 


-2048 


PLOT 




SF819 


63513 


-2023 


HLINE 


1 


SF828 


63528 


-2008 


VLINE 


1— J 


SF832 


63538 


-1998 


CLRSCR 


1 


$F836 


63542 


-1994 


CLRTOP 




SF864 


63588 


-1948 


SETCOL 


1 


SF871 


63601 


-1935 


SCRN 


1 "" 


SF941 


63809 


-1727 


PRNTAX 




SF94A 


63818 


-1718 


PRBL2 


1 


SFA47 


63845 


-1691 


NEWBRK 


1 


SFA62 


64098 


-1438 


RESET 


1 


SFB1E 


64286 


-1250 


PREAD 


i i , 


SFB6F 


64367 


-1169 


SETPWRC 


■ * 


SFBB3 


64435 


-1101 






SFBCO 


64448 


-1088 






SFBOD 


64477 


-1059 


BELLI 


^"^"— • 










* •' 


SFC42 


64578 


-958 


CLREOP 


1 


SFC58 


64600 


-936 


HOME 




$FC9C 


64668 


-868 


CLREOL 


' 


SFC9E 


64670 


-866 


CLEOLZ 


I — 


SFCA8 


64680 


-856 


WAIT 




SFDOC 


64780 


-756 


RDKEY 


L 


SFDtB 


64795 


-741 


KEYIN 


" J 


SFD35 


64821 


-715 


RDCHAR 


1^ 


SFD67 


64871 


-665 


GETLNZ 




SFD6A 


64874 


-662 


GETLN 


L 


SFD6F 


64879 


-657 


GETLN1 


* f 1 


SFD8B 


64907 


-629 


CROUT1 


1^ 


SFD8E 


64910 


-626 


CROUT 


| 


SFDDA 


64986 


-550 


PRBYTE 


1- 


SFDE3 


64995 


-541 


PRHEX 


■—4 


$FDED 


65005 


-531 


COUT 


1 - 


SFDFO 


65008 


-528 


COUT1 


L 


SFE2C 


65068 


-468 


MOVE 


■ 


SFE36 


65078 


-458 


VERIFY 


1 ~ 


SFF2D 


65325 


-211 


PRERR 


I 


SFF3A 


65338 


-198 


BELL 




SFF3F 


65343 


-193 


IOREST 


SFF4A 


65354 


-182 


IOSAVE 


I 


SFF58 


65368 


-168 


IORTS 


1 


SFF69 


65385 


-151 


{Monitor) 


■""-■ 


SFFFA 


65530 


-6 




1 


SFFFB 


65531 


■5 




I 


SFFFC 


65532 


■4 




R* 


SFFFD 


65533 


-3 




SFFFE 


65534 


-2 


IROVECT 


■ 


SFFFF 


65535 


-1 





Type 



Section 



entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


58 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


E.2 


entry 


2.6 


entry 


9.2 


entry 


2.6.4 


■dent 


F.1.2 


ident 


F.1.2 


entry 


4.2.2 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 




entry 


3.2.1 


entry 


3.2.2 


entry 


4.1.2 


entry 


4.1.2 


entry 


3.2.3 


entry 


4.1.2 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


5.8 


entry 


3.3.1 


entry 


3.3.2 


entry 




entry 




entry 


5.8 


entry 


4.2.2 


entry 




entry 




RTS 




entry 


10.1 


vector 




vector 




vector 




vector 




vector 




vector 





Description 

Plots a low -resolution block 
Draws low-resolution horizontal line 
Draws low-resolution vertical line 
Clears low-resolution screen 
Clears top 40 low-resolution lines 
Sets low-resolution color (Table 5-4) 
Reads color of low-resolution block 

Displays (A) and (X) in hex 
Sends (X) blanks to output 

Apple lie break handler 
Hardware reset routine 

Reads hand control position 
Routine to create power-up byte 
Machtne identification byte 
Machine identification byte 
Sends 1 kHz beep to speaker 

Clears from cursor to bottom 
Clears; cursor to upper left 
Clears from cursor to end of line 
Clears from BASL to end of line 
Delays for time specified by (A) 

Displays cursor, |umps to (KSW) 
Waits for keypress, reads key 
Gets input, interprets ESC codes 
Sends CR to output, goes to GETLN 
Displays prompt, gets input line 
No prompt; gets input line 
Clears to end of line, calls CROUT 
Sends CR to output 
Sends (A) to output 
Displays low nibble of (A) in hex 
Jumps to (CSW) 
Displays (A), advances cursor 

Copies (memory) elsewhere 
Compares two blocks of memory 

Sends ERR to output; beeps 
Sends CONTROL-G to output 
Loads (S45-S49) into registers 
Stores (A.X.Y.P.S) at $45-549 
Location of known RTS instruction 
Standard Monitor entry point 

Low-order NMI vector (unused) 
High-order NMI vector (unused) 
Low-order RESET vector ($62) 
High-order RESET vector ($FA) 
Low-order IRQ vector ($03) 
High-order IRQ vector (SCB) 



Q 



« 



I 



C.5 Monitor Addresses 



[35" 



=a : 



I 

■ 

I 



t 



=3 



ti 



-n 



x 

Q 



This appendix is an overview of the characteristics of operating 
systems and languages when run on the Apple lie. It is not 
intended to be a full account. For more information, refer to the 
manuals that are provided with each product. 



D. 1 Operating Systems 



This section discusses the operating systems that the Apple lie 
does and does not work with. 



D. 1. 1 ProDOS 

ProDOS is the preferred disk operating system for the 
Apple He. It supports startup from the external disk drive, 
interrupts, and all other hardware and firmware features of the 
Apple He. 



D. 1.2 DOS 

The Apple lie works with DOS 3.3. Its disk drive support 
hardware and firmware can also access DOS 3.2 disks by 
using the BASICS disk. However, neither version of DOS takes 
full advantage of the features of the Apple lie. DOS support is 
provided only for the sake of Apple II series compatibility. 



D.1 Operating Systems (37~ 



■ D.2 Languages 

For further Information about these 
languages, refer to the manuals 
that came with them. 



Use the appendixes to make or 
find decimal conversions. 
Appendix H has tables and 
examples to help you convert 
numbers between hexadecimal, 
decimal, and negative 
(complementary) decimal. All the 
addresses listed in Appendixes B 
and C— screen holes, hardware 
addresses, firmware entry points, 
and so on — are given in all three 
numeric forms. 



D.1.3 Pascal Operating System 

Version 1.2 of the Pascal Operating System uses the 

80/40 switch and the interrupt features of the Apple lie, while 

remaining compatible with the other Apple II series computers 

While the Apple lie works with Pascal 1.1, this version of the 
Pascal Operating System does not use the 80/40 switch or 
handle interrupts. 

The Apple He does not work with Pascal 1.0, because the 
input/output firmware entry points are rigidly defined (rather 
than being accessed via a table), and the firmware does not 
support these entry points. 



D.1.4CP/M 

CP/M. and any other operating system that requires an interface 
card, will not work on the Apple lie. 



This section discusses special techniques to use, and 
characteristics to be aware of. when using Apple programming 
languages with the Apple lie. It is also a guide to using this 
reference manual with these languages. 



D.2. 1 Applesoft BASIC 



The focus of the chapters in this manual is assembly language, 
and so most addresses and values are given in hexadecimal 
notation. 

Use a PEEK in BASIC (instead of LDA in assembly language) to 
read a location, and a POKE (instead of STA) to write to a 
location. If you read a hardware address from a BASIC 
program, you get a value between and 255. Bit 7 has a value 
of 128. so if a soft switch is on, its value will be equal to or 
greater than 128; if the switch is off, the value will be less 
than 128. 



i 

i 

A 

i 

a 



~3Q\ 



Appendix D: Operating Systems and Languages 



• 






0.2.2 Integer BASIC 

Unless you load a version of DOS into your Apple lie, you will 
not have Integer BASIC available inside the machine. ProDOS 
does not support Integer BASIC. 



D.2.3 Pascal Language 

The Pascal language works on the Apple lie under versions 1.1 
and 1.2 of the Pascal Operating System. However, for best 
performance, use Pascal version 1.2. 



L D.2A FORTRAN 

V^i FORTRAN works under version 1.1 of the Pascal Operating 

I System which, as explained in section D.1.3, does not detect or 

f— * use certain Apple lie features, such as the 80/40 switch or 

}""4 auxiliary memory. Therefore, FORTRAN does not take 

advantage of these features either. 

ft 

l: 
i 

I; 

. ' D.2 Languages 139 



L 
C 



E. 1 1ntroduction 



C 






3| 
-1 



B 

"o 

Q. 

X 
B 



This appendix presents a unified account of the sources of 
interrupts on the Apple lie, how the firmware handles the 
interrupts, and how to use interrupt-driven features directly in 
those rare cases when the firmware cannot meet your needs. 

Warning 

// you use interrupt hardware directly, rather than using the 
built-in interrupt-handling firmware, compatibility with possible 
future Apple II series computers or revisions cannot be 
guaranteed. 



This section orients you to interrupts and their effects on the 
Apple lie hardware. 



E. 1. 1 What Is an Interrupt? 

On a computer, an interrupt is a signal that abruptly causes the 
computer to stop what it is currently doing and immediately 
attend to an important time-dependent task. For example, the 
Apple lie mouse sends an interrupt to the computer every time 
it moves. This is necessary because unless the mouse is read 
shortly after it moves, the signal indicating its direction is lost. 

When an interrupt occurs, control passes to an interrupt 
handler, which must record the exact state of the computer at 
the moment of the interrupt, determine the source of the 
interrupt, and take appropriate action. It is important that the 



E.1 Introduction [41 



computer preserve a snapshot of its state when interrupted, so 
that when it continues later with what it had been doing, those 
conditions can be restored. 



i 

Itr-" 

3 

i 

a 



"42*1 Appendix E: Interrupts 



E.1.2 Interrupts on Apple II Computers 

Interrupts have not always been fully supported on the Apple II. 

All versions of Apples DOS. as well as the Monitor program 

rely on the integrity of location £45. which the built-in interrupt 

handler has always destroyed by saving the accumulator in it. 

Most versions of Pascal simply do not work with interrupts 

enabled. 

The Apple He built-in interrupt handler now saves the 

accumulator on the stack instead of in location S45. Thus both 

DOS and the Monitor work with interrupts on the Apple lie. 

If however you want software that uses interrupts to work on 

the Apple lie and the Apple II Plus, you must use either 

ProDOS Apples new enhanced disk operating system, or 

Pascal 1.2. Both operating systems have full interrupt support 

built in. 

Interrupts are effective only if they are enabled most of the 

time Interrupts that occur while interrupts are disabled cannot 

be detected Due to the critical timing of disk read and write 

operations. Pascal. DOS, and ProDOS turn off interrupts while 

accessing the disk. Thus it is important to remember that while j 

a disk drive is being accessed, all sources of interrupts 

discussed below are turned off. _ 

On the Apple Me only, interrupts are periodically turned off while 

80-column screen operations are being performed. This is most 

noticeable while the screen is scrolling. Also, most peripheral ^ 

cards used in the Apple He disable interrupts while reading and ^f 

writing. 

3 



■ — k 



=d 



1 



u 



L 



E.1.3 Interrupt Handling on the 65C02 

From the point of view of the 65C02, there are three possible 
causes of interrupts. 

1. If 65C02 interrupts are not masked (that is. the CLI 
instruction has been used), the IRQ line on the 
microprocessor can be pulled low. This is the standard 
technique by which a device indicates that it needs 
immediate attention. 

2. The processor executes a break (BRK. opcode S00) 
instruction. 



3. A non-maskable interrupt (NMI) occurs. Because the NMI 
line in the Apple lie's 65C02 is not used, this never happens. 

Options 1 and 2 cause the 65C02 to save the current program 
^.^^ counter and status byte on the stack and then jump to the 

»*Jj routine whose address is stored in SFFFE and SFFFF. The 

sequence performed by the 65C02 is: 



1. If IRQ. finish executing the current instruction. (If BRK. 

current instruction is already finished.) 

2. Push high byte of program counter onto stack. 

3. Push low byte of program counter onto stack. 

4. Push program status byte onto stack. 

5. Jump to address stored in $FFFE, SFFFF, that is, 
JMP (SFFFE). 

The different sources of interrupt signals are discussed below. 



^jj E. 1.4 The Interrupt Vector at SFFFE 



In the Apple lie computer there are three separate regions of 
memory that contain address $FFFE: the built-in ROM, the 
bank-switched memory in main RAM. and the bank-switched 
memory in auxiliary RAM. The vector at $FFFE in the ROM 
points to Apple lie's built-in interrupt handling routine. Due to 
the complexity of interrupts in the Apple lie. it is recommended 
that you use it rather than writing your own interrupt handling 
routine. 

When you initialize the mouse or serial communication firmware, 
copies of the ROM's interrupt vector are placed in the interrupt 
vector addresses in both main and auxiliary bank-switched 



•J E.1 Introduction f43~ 



'A 



memory. If you plan to use interrupts and the bank-switched 
memory without the mouse or communication firmware, you 
must copy the ROMs interrupt vector yourself. ~r. 



E.2 The Built-in Interrupt Handler 

The built-in interrupt handler is responsible for determining 
whether a BRK or an IRQ interrupt occurred. If it was an IRQ 
interrupt, it decides whether the interrupt should be handled 
internally, handled by the user, or simply ignored. 

The built-in interrupt handling routine records the current 

memory configuration, then sets up its own standard memory -- 

configuration so that a user's interrupt handler knows the 

precise memory configuration when it is called. 

Next the handler checks to see if the interrupt was caused by a 

break instruction, and if it was, handles it as described in 

section E.4. 

If the interrupt was not caused by a BRK. the handler checks 

for interrupts that it knows how to handle (for example, a 

properly initialized mouse) and handles them. ^J 

Depending on the state of the system, it either ignores other 

interrupts, or passes them to a user's interrupt handling rout.ne 

whose address is stored at $3FE and S3FF of main memory. 

After handling an interrupt itself, or after the user's handler 

returns (with an RTI). the built-in interrupt handler restores the ^ 

memory configuration, and then does an RTI to restore 

processing to where it was when the interrupt occurred. 

Figure E-1 illustrates this whole process. Each of the steps is 

explained in detail in the sections that follow. 



~^4~l Appendix E: Interrupts 



Figure E- 1. Interrupt-Handling Sequence 



^ 

^ 



Interrupted 

Program 



Proceisor 



Built-in 
Handler 



Program 



♦-Push Address 
Push Status 
JMP(SFFFE)- 



Uwrt 
Handler 



Program ■*■ 



Pull Status -+- 
Pull Address 



■Save old and 
set new memory 
configuration. 

II BRK. then go to 
break handler (SFA47). 

Our interrupt? 

NO: Push Address 
Push Status 
JMP($3FE)- 

YES: Handle it. 

Restore memory-* 
configuration. 

RTI 



Handle interrupt. 



RTI 



E 



E 
t. 



E.2 The Built-in Interrupt Handler 



45 



A 



j 



E.2. 1 Saving the Memory Configuration J 

The built-in interrupt handler saves the state of the system, and [ 

sets it to a known state according to these rules: 

• If 80STORE and PAGE2 are on, then it switches in Text 
Page 1 (PAGE2 off) so that main screen holes are 
accessible. 

• It switches in main memory for reading (RAMRD off). 

• It switches in main memory for writing (RAMWRT off). 

• It switches in ROM addresses $D000-$FFFF for reading §H> 
(RDLCRAM off). 

• It switches in main stack and zero page (ALTZP off). 

• It preserves the auxiliary stack pointer, and restores the 

main stack pointer (see section E.2.2). ^^ , 

Note: Because main memory is switched in, all memory 

addresses used later in this appendix are in main memory )--— 

unless otherwise specified. )£** 



E.2.2 Managing Main and Auxiliary Stacks sr - 

Because the Apple lie has two stack pages, the firmware has ^ 

established a convention that allows the system to be run with 

two separate stack pointers. Two bytes in the auxiliary stack 

page are to be used as storage for inactive stack pointers: ^^ 

$100 for the main stack pointer when the auxiliary stack is |^ 

active, and $101 for the auxiliary stack pointer when the main 

stack is active. ^ 

When a program that uses interrupts switches in the auxiliary 
stack for the first time, it should place the value of the main . 

stack pointer at auxiliary stack address S100, and initialize the 
auxiliary stack pointer to SFF (the top of the stack). When it r - . 

subsequently switches from one stack to the other, it should | 

save the current stack pointer before loading the pointer for the 
other stack. 

When an interrupt occurs while the auxiliary stack is switched 
in, the current stack pointer is stored at $101, and the main 
stack pointer is retrieved from $100. Then the main stack is 
switched in for use. After the interrupt has been handled, the 
stack pointer is restored to its original value. 



■k 



46l Appendix E: Interrupts 



J 



t 



E.3 User's Interrupt Handler at $3FE 



> 




Screen hole locations can be set up to indicate that the user's 
interrupt handler should be called when certain interrupts occur. 
To use such a routine, place its address at $3FE and $3FF in 
main memory, low byte first. 

The user's interrupt handler should do the following: 

• Verify that the interrupt came from the expected source. The 
following sections describe how this should be done for 
each interrupt source. 

• Handle the interrupt as desired. 

• Clear the interrupt, if necessary. The following sections 
describe how to clear the interrupts. 

• Return using an RTI instruction. 

If your interrupt handler needs to know the memory 
configuration at the time of the interrupt, it can check the 
encoded byte stored four bytes down on the stack. This byte is 
explained in section E.4. 

In general there is no guaranteed response time for interrupts. 
This is because the system may be doing a disk operation, 
which could last for several seconds. 

Once the built-in interrupt handler has been called, it takes 
about 250 to 300 microseconds for it to call your interrupt 
handling routine. After your routine returns, it takes 40 to 
140 microseconds to restore memory and return to the 
interrupted program. 

If memory is in the standard state when the interrupt occurs, 
the total overhead for interrupt processing is about 
150 microseconds less than if memory is in the worst possible 
state (80STORE and PAGE2 on, auxiliary memory switched in 
for reading and writing, auxiliary bank-switched memory page 2 
switched in for reading and writing). 



E 



E.3 User's Interrupt Handler at $3FE 



47 



y- 

EA Handling Break Instructions __ -- 

After the interrupt handler has set the memory configuration, it 
checks to see if the interrupt was caused by a BRK 
(opcode $00) instruction. (If it was, bit 4 of the processor status 
byte is a one). If so, it jumps to a break handling routine, which 
saves the state of the computer at the time of the break as 
follows. 

Information Location 

Program counter (low byte) $3A 

Program counter (high byte) $3B 

Encoded memory state $44 

Accumulator $45 

X register $46 

Y register $47 

Status register S48 

Finally the break routine jumps to the routine whose address is 
stored at $3F0 and $3F1. 

The encoded memory state in location $44 can be interpreted 
as follows: 



&- 



Bit 7 = 

Bit 6 

Bit 5 

Bit 4 

Bit 3 

Bit 2 

Bit 1 

Bit = 



if 80STORE and PAGE2 both on 

if auxiliary RAM switched in for reading 

if auxiliary RAM switched in for writing 

if bank-switched RAM being read 

if bank-switched $D000 page 1 switched in 

if bank-switched $D000 page 2 switched in 



a 



48 1 Appendix E: Interrupts — 



■ E.5 Sources of Interrupts 

The Apple He can receive interrupts from many different 
_ sources. Each source is enabled and used slightly differently 

^U from the others. There are two basic classes of interrupt 

sources: those associated with use of the mouse, and those 
_ associated with the two 6551 ACIA circuits (the chips that 

^| control serial communication). 

The interrupts that are associated with the mouse are these: 

• An interrupt can be generated when the mouse is moved in 
the horizontal (X) direction. 



3 



-4 



An interrupt can be generated when the mouse is moved in 
the vertical (Y) direction. 



• An interrupt can be generated every 1/60 second. This is 
called the vertical blanking (VBL) interrupt, and is 
synchronized with a signal used for the video display. 

~g • Using the firmware, interrupts can be generated when the 

mouse button is pressed. 

=3 

=3 



E.5 Sources of Interrupts [49~ 



The interrupts that are associated with the ACIAs are these: 

• An interrupt can be generated when a key is pressed. The ju 
firmware can use this interrupt to buffer keystrokes, or it can 

pass the interrupt on to the user. ^* 

• An interrupt can be generated by a device attached to the 
external disk drive port. The firmware can pass this interrupt 

on to the user. ^^ 

• An interrupt can be generated when either ACIA has 

received a byte of data from its port. The firmware can use _ - 

this interrupt to buffer data or it can pass the interrupt on to ^ 
the user. 

• An interrupt can be generated when pin 5 of either serial —- 
port changes state (device ready/not ready to accept data). £■ 
When the serial firmware is active, this interrupt is absorbed; 
however, the serial firmware uses the signal to decide «— 
whether or not to transmit the next byte of data. 

An interrupt can be generated when either ACIA is ready to 
accept another character to be transmitted. When the serial 
firmware is active, this interrupt is absorbed; however, the 
serial firmware uses the signal to decide whether or not to _^ 

transmit the next byte of data. U« 

An interrupt is generated when the keyboard strobe is 

-i -j tu« *;—>-.. ./i.-<-t ohenrhc thlc intPITlint. -^™ 



• 



cleared. The firmware absorbs this interrupt. 



E.6 Firmware Handling of Interrupts 



The following sections discuss the various sources of interrupts 

and how they should be used in conjunction with the built-in ^ 

interrupt handler. 



E.6. 1 Firmware for Mouse and VBL rr 

As described in Chapter 9, the mouse can be initialized (by the ^ 
SETMOUSE call) to nine different modes that enable one or 
more sources of interrupts. In transparent mode, the interrupts 
are entirely handled by the built-in interrupt handler; the other 
modes require a user-installed interrupt handler. 



~£5~| Appendix E: Interrupts 



5 

* 



L 

L 


When the mouse is initialized, the interrupt vector is copied to 
addresses SFFFE and SFFFF in main and auxiliary 
bank-switched RAM. This permits mouse interrupts with any 
memory configuration. 


When the mouse is active, possible sources of interrupts are: 




• Mouse movement in the X direction 


• Mouse movement in the Y direction 


^^^^™ 


• Change of state of the button 


— 


• Rising edge of the vertical blanking signal. 




When an interrupt occurs, the built-in interrupt handler 
determines whether that particular interrupt source was enabled 
(by the SETMOUSE call). If so, the user's interrupt handler, 
whose address is stored at $3FE, is called. 


E 


The user's interrupt handler should first call SERVEMOUSE to 
determine the source of the interrupt. This call updates the 
mouse status byte at S77C and returns with the carry bit clear if 
mouse movement, button, or vertical blanking was the source of 
the interrupt. 


The values of this mouse status byte at S77C are as follows: 


1 — 


Bit 1 means that 


L 

l: 

» — g 

L 


3 Interrupt was from vertical blanking 

2 Interrupt was from button 

1 Interrupt was from mouse movement 


If the interrupt was due to mouse movement or button, the 
user's interrupt handler should then do a call to READMOUSE. 
This causes the mouse coordinates and status to be updated as 
follows: 

$47C Low byte of X coordinate 
S4FC Low byte of Y coordinate 
S57C High byte of X coordinate 
$5FC High byte of Y coordinate 


c 

1" 




Ml 


E.6 Firmware Handling of Interrupts 1 51 



button down on last READMOUSE 



= no movement since last READMOUSE 



Warning 

Do not call the buffer reading routine directly. Its entry address 
wili not be the same in future versions of the computer 



J 



"i 

$77C Button and movement status 

Bit Means ii— <* 

7 = button up; 1 = button down 

6 = button up on last READMOUSE 



movement since last READMOUSE 
3-1 always set to (interrupt cleared) 

After the interrupt has been handled, the routine should 
terminate with an RTI. E - 

As already mentioned, interrupts may be missed during disk 
accesses. ^ -— 

It you turn on mouse interrupts without initializing the mouse, 
the built-in interrupt handler will absorb the interrupts. If you ^ — 

want to handle mouse interrupts yourself, you must write your ^ 

own interrupt handler and place vectors to it at addresses 
$FFFE and $FFFF in bank-switched RAM. Interrupts will be ^^ 

ignored whenever the $D000-$FFFF ROM is switched in. ^— 



E.6.2 Firmware for Keyboard Interrupts 

The Apple lie hardware is able to generate an interrupt when a 
key is pressed. The firmware is able to buffer up to 
128 keystrokes, completely transparently, when properly 
enabled to do so. It saves them in the second half of page 8 of 
auxiliary memory. After the buffer is full, subsequent keystrokes 
are ignored. Because interrupts are only generated when 
keypresses occur, characters generated by the auto-repeat 
feature are not buffered. They can, however, be read when the 
buffer is empty. 
Once keyboard buffering has been turned on, the next key 
should be read by calling RDKEY ($FD0C). 






"52I Appendix E: Interrupts 



- 

* 



■ ■ 

l: 



l: 



The special characters ( control K s) (stop list) and 
t control K g) (stop Applesoft execution) do not work 
while keyboard buffering is turned on. A new keystroke, 

I a K coNTRpf )-QT). clears the buffer. 

Using Keyboard Buffering Firmware 

See Chapter 8. Keyboard buffering is automatically turned on when the serial 

firmware is placed in terminal mode. Otherwise you must turn it 
on yourself. 

1. Disable processor interrupts (SEI). 

2. Set location $5FA to $80. This tells the firmware to buffer 
keystrokes without calling the users interrupt handler. 

3. Set locations $5FF and $6FF to $80. These are pointers to 
where in the buffer the next keystroke will be stored and 
where the next will be read from, respectively. 

4. Turn on the ACIA for port 2 by setting the low nibble of 
$C0AA to the value $F. For example: 

LDA SCOAA ;read port 2 ACIA command register 

OR A '$0F ;set low nibble to $F 

STA SCOAA ;set port 2 ACIA command register 

If you are using the serial ports at the same time, just set 
the low bit of $C0AA to 1 . This prevents receiver interrupts 
from being turned off. 

A PR#2 or IN#2 or the equivalent will shut off keyboard 
interrupts. 

5. Enable processor interrupts (CLI). 



l: 






Using Keyboard Interrupts Through Firmware 

Keyboard interrupts are received through the ACIA for port 2. 
They can be enabled as follows: 

1. Disable processor interrupts (SEI). 

2. Set location $5FA to $C0. This tells the firmware to identify a 
keystroke interrupt, and to call the user's interrupt handler. 

3. Turn on the ACIA for port 2 by setting the low nibble of 
$C0AA to the value $F. For example: 



E.6 Firmware Handling of Interrupts 1 53 



id 

LDA SCO A A ;read port 2 ACIA command register 

OR A *$0F ;set low nibble to $F 

5TA SCQAA ;set port 2 ACIA command register ± 



U 



4. Enable processor interrupts (CLI). 

When the user's interrupt handler is called, it can identify the U~- | 

keyboard as the interrupt source by reading location $4FA. This 

is a copy of the ACIA status register at the time of the interrupt. _-J 

If the interrupt was due to something on the ACIA for port 2. 

bit 7 is set. If the interrupt was caused by a keystroke, bit 6 is 

set and bit 5 is unchanged. 

After servicing this interrupt, the interrupt handler should clear 

the interrupt by setting $4FA to 0. 

■ " U— - 

E.6.3 Using External Interrupts Through Firmware 

Pin 9 of the external disk drive connector (EXTINT) can be used -— 
to generate interrupts through the ACIA for port 1. It can be re- 

used as a source of interrupts {on a high-to-low transition) if 
enabled as follows: 

1. Disable processor interrupts (SEI). 

2. Set location S5F9 to SCO. This tells the firmware to identify 

an external interrupt, and to call the user's interrupt handler. ■— 

3. Turn on the ACIA for port 1 by setting the low nibble of ^| 
SC09A to the value $F. For example: 

LDA SC09A ;read port 1 ACIA command register 

rjRA *$0F ;set low nibble to $F -^ 

STA $C09A ;set port 1 ACIA command register *•* 

4. Enable processor interrupts (CLI). _^ 
When the users interrupt handler is called, it can identify this {** 
interrupt by reading location S4F9. This is a copy of the ACIA 

status register at the time of the interrupt. If the interrupt was 

due to something on the ACIA for port 1. bit 7 is set. If the ±* 

interrupt was caused by the external interrupt line, bit 6 is clear 

and bit 5 is unchanged. 

After servicing this interrupt, the interrupt handler should clear 

the interrupt by setting S4F9 to 0. J 



"54I Appendix E: Interrupts 



L 

■ k 

L 

I U 

H 
L 

l: 
l: 

i: 



E.6.4 Firmware for Serial Interrupts 

The Apple He hardware is able to generate interrupts both when 
the ACIA receives data and when it is ready to send data. The 
built-in interrupt handler responds to incoming data only. The 
firmware is able to buffer up to 128 incoming bytes of serial 
data from either serial port. After the buffer is full, data is 
ignored. Only one port can be buffered at a time. 

The following sections assume that the serial port to be 
buffered is already initialized, as explained in Chapter 8. 

Using Serial Buffering Transparently 

Serial buffering is automatically turned on when the serial 
firmware is placed in terminal mode. Otherwise you must turn it 
on yourself, as follows: 

1. Disable processor interrupts (SEI). 

2. Set location S4FF to SC1 to buffer port 1, or to $C2 to buffer 
port 2. 

3. Set locations $57F and $67F to 0. These are pointers to the 
next byte in the buffer to be used and the next character to 
be read from the buffer, respectively. 

4. Turn on the ACIA for the port by setting the low nibble of 
SC09A for port 1 or $C0AA for port 2 to $D. For example: 

LDA IC09A 

AND $F0 

ORA *$0D 

STA SC09A 



;read port 1 ACIA command register 

;clear low nibble 

;set low nibble to $D 

;set port 1 ACIA command register 



L 



— See Chapter 8. 



The in bit 1 of the command register enables receiver 
interrupts, thus an interrupt is generated when a byte of data 
is received. 

5. Enable processor interrupts (CLI). 

When serial port buffering is thus enabled, normal reads from 
the serial port firmware fetch data from the buffer rather than 
directly from the ACIA. 



■ ■ ■ 

l: 



E.6 Firmware Handling of Interrupts 



55 






Using Serial Interrupts Through Firmware 

It is also possible to use the firmware to call the user interrupt 
handler whenever a byte of data is read by the ACIA. In this 
mode buffering is not performed by the firmware. 

1. Disable processor interrupts (SEI). 

2. Set location 54FF to a value other than $C1 or $C2. 

3. Turn on the ACIA for the port by setting the low nibble of 
SC09A for port 1 or $C0AA for port 2 to $D. For example: 

LDA $C09A ;read port 1 ACIA command register 

AND $F0 ;clear low nibble 

ORA 'SOD ;set low nibble to $D 

STA SC09A ;set port 1 ACIA command register 

The in bit 1 of the command register enables receiver 
interrupts, thus an interrupt is generated when a byte of data 
is received. 

4. Enable processor interrupts (CLI). 

When a serial port is thus enabled, the user's interrupt handler 
is called each time the port receives a byte of data. The status 
byte saved by the firmware (S4F9 for port 1; $4FA for port 2) 
has the high bit set if the interrupt occurred on that port. Bit 3 
is set if the interrupt was due to a received byte of data. 

The interrupt handler should clear the interrupt by clearing 
bits 7 and 3 of that port's status byte ($4F9 for port 1 ; $4FA for 
port 2). 



* 



56 | Appendix E: Interrupts 



=2 



■—3 

E 

E 



Transmitting Serial Data 

The serial firmware does not implement buffering for serial 
output. Instead it waits for two conditions to be true before 
transmitting a character: 

• The AClA's transmit register must be ready to accept a 
character. This is true if bit 4 of the AClA's status register 
is 1. 

• The device must signal that it is ready to accept data. This is 
true if bit 5 of the AClA's status register is 0. Bit 5 is if 
pin 5 of the port's connector is also 0. 

When the serial firmware is active, a change of state on pin 5 of 
that port generates an interrupt. That interrupt is absorbed, but 
the data remains in bit 5 of the status register. Interrupts from 
the AClA's transmit register are normally disabled. 

A Loophole in the Firmware 

So that programs can make use of interrupts on the ACIAs 
without affecting mouse interrupt handling, there is a tiny 
loophole purposely left in the built-in interrupt handler. If 
transmit interrupts are enabled on the ACIA— that is, if bits 3, 2, 
and of the AClA's command register have the values 0, 1, 
and 1 , respectively— then control is passed to the user's 
interrupt handler if the interrupt is not intended for the mouse 
(movement, button, or VBL). 

This means that you can write more sophisticated serial 
interrupt handling routines than the limited firmware space could 
provide (such as printer spooling). The firmware will still set 
memory to its standard state, handle mouse interrupts, and 
restore memory after your routine is finished. 

When you receive the interrupt, neither AClA's status register 
has been read. You are fully responsible for checking for 
interrupts on both ACIAs, determining which of the four 
interrupt sources on each ACIA caused the interrupt, and how 
to handle them. Refer to the 6551 specification for more details. 
The built-in firmware itself is an excellent example of how 
interrupts on the ACIA can be handled. 



E.6 Firmware Handling of Interrupts 



fsf 



E.7 Bypassing the Interrupt Firmware 



The following sections give further details on using interrupts on 
the Apple He computer without using the built-in interrupt 
handler. 



E.7. 1 Using Mouse Interrupts Without the Firmware ^ 

To use mouse interrupts without the firmware, as mentioned 
above, you must set your own interrupt vectors. If $D000-$FFFF 
ROM is ever switched in, the built-in interrupt handler will 
absorb the mouse interrupts. Tables E-1 and E-2 show how to 
activate and read mouse interrupts without using the firmware. 
Remember to disable interrupts (SEI) before enabling mouse -— 

interrupts, then turn them on when done (CLI). 



Table E-1. Activating Mouse Interrupts 



To Activate 
Interrupts On 


Enable IOU 
Access 


Select 
Source 


Enable 
Source 


Disable 
IOU Access 


Mouse X 
(rising edge) 


STA SC079 


STA SC05C 


STA SC059 


STA SC078 


Mouse X 
(falling edge) 


STA SC079 


STA SC05D 


STA SC059 


STA SC078 


Mouse Y 
(rising edge) 


STA SC079 


STA SC05E 


STA SC059 


STA SC078 


Mouse Y 
(falling edge) 


STA SC079 


STA SC05F 


STA SC059 


STA SC078 


VBL 


STA SC079 




STA SC05B 


STA SC078 


Table E-2. Reading Mouse Interrupts 








To Read 
Interrupts From 


Read Direction 
(A.S.A.P.) 


Determine 
Source 


Handle 
It 


Return 


Mouse X 


LDA SC066 


LDA SC015 
(bit 7 - 1 if true) 


... 


RTI 


Mouse Y 


LDA SC067 


LDA5C017 
(bit 7 = 1 if true) 


... 


RTI 


VBL 




LDASC019 
(bit 7=1 if true) 


... 


RTI 



~58l 



The mouse direction data read from SC066 and SC067 is 
guaranteed to be valid for at least 40 microseconds. Average 
duration is at least 200 microseconds. This means you should 
read the direction as soon as possible. 



Appendix E: Interrupts 



- 



fa 

l: 



i 



-4 



■=3 

l: 

E 

t; 

E 



E.7.2 Using ACIA Interrupts Without the Firmware 

To use ACIA interrupts without the firmware, you must set your 
own interrupt vectors. If the $D000-SFFFF ROM is ever 
switched in, the built-in interrupt handler will handle the interrupt 
as determined by certain mode bytes (section E.6.1). 

When writing your serial interrupt handler, refer to Figures 11.31 
through 11-33 and to the Synertek 6551 ACIA specification. As 
shown in Chapter 11, the ACIA's have the following 
connections: 

Port 1: DSR line connected to the EXTINT line on 

the external disk port 

DCD line connected to pin 5 of Port 1 
connector 

Port 2: DSR line goes high when a key is 

pressed 

DCD line connected to pin 5 of Port 2 
connector 

The ACIA registers have the following addresses; 

Port 1: 



Port 2: 



Data Register 


- SC098 


Status Register 


- SC099 


Command Register 


- SC09A 


Control Register 


= $C09B 


Data Register 


= $C0A8 


Status Register 


= SC0A9 


Command Register 


= $C0AA 


Control Register 


= SCOAB 



L~J 



E.7 Bypassing the Interrupt Firmware 



[59" 






t 

■ | 

i 

E 



F. 1 Overview 



n 

o 

-D 

o 



This appendix compares the Apple He to the Apple He, 
Apple II Plus, and Apple II. 



This appendix does not contain an exhaustive list of 
differences. However, it does include those differences most 
likely to affect the accuracy of programs, displays, and 
instructions created for end users of two or more models from 
the Apple II Series. 

As an overview, the differences between the Apple II series 
computers can be expressed as a series of equations: this 
computer equals that one plus or minus certain features. 

Note: The following equations are merely an overview of 
what each model of Apple II Series is with respect to its 
predecessor. These equations are in terms of functional 
equivalence, not strict equality. For example, 

Apple He = Apple II Plus + Apple Language Card 

does not mean there is an actual language card or slot — just 
that the one machine functions as if it were the other with 
such a card (with its connector) in a slot. 



F.1 Overview 161 



Apple II Plus =11 + Autostart ROM 

+ Applesoft firmware _ — 

+ 48K RAM standard U- 

- Old Monitor ROM 

Integer BASIC firmware . . 

Apple lie = II Plus + Apple Language Card (with 16K 

of RAM) ^* 

+ 80-column (enhanced) video L-L- 

firmware 
+ built-in diagnostics _ 

+ full ASCII keyboard i" 1 '. 

+ internal power light 
+ FCC approval _ 

+ improved back panel | L- 

-f 9-pin back panel game 

connector 
+ auxiliary slot (with possibility of j t^. 

80-column text card 
+ extra 64K RAM) j ( 

- slot o y - 

Apple lie = He + extended 80-column text card ^ 

+ 80/40 switch «U« 

+ keyboard switch 

+ disk light ^^ 

+ disk controller port 

+ disk drive 

+ mouse port 

+ serial printer port 

+ serial communication port 

+ built-in port firmware 

I video expansion connector 

removable cover 

- slots 1 to 7 
auxiliary slot 
internal power light 
cassette I/O connectors 

- internal game I/O connector 
(hence no game output) 
auxiliary video pin 
monitor cassette support 



62 I Appendix F: Apple II Series Differences 



I 

i 

! 



I— U 



>-- 



E 



E 

t 



F.7.7 Type of CPU 

The CPU in the Apple II and II Plus is the 6502. The Apple lie 
uses a 6502A. The Apple lie uses the 65C02: this is a 
redesigned CMOS CPU that has 27 new instructions, new 
addressing modes, and for some instructions a differing 
execution scheme and machine cycle counts (see Appendix A). 
Programs written for the Apple He will run on the earlier 
machines only if they do not contain instructions unique to the 
65C02. or depend on instruction cycle times that differ. 

F. 1.2 Machine identification 

Identification of Apple II series computers is as follows: 

Machine SFBB3 SF8C0 SF81E 



Apple II 


S38 




Apple II Plus 


SEA 




Apple He 


S06 


SEA 


Apple He 


S06 


$00 


Apple III In Apple II 






Emulation Mode 


SEA 





S8A 

Any future Apple II series computer or ROM release will have 
different values in these locations. Machine identification 
routines are available from Apple Vendor Technical Support. 

With regard to ProDOS. its MACHID byte, at location SBF98 on 
the global page, will have bit 3 set to if the computer is an 
Apple II, II Plus, lie, or III, and a 1 if the computer is not one of 
these machines. In addition, for an Apple lie, bits 7 and 6 are 
set to binary 10. 

Bits 7 and 6 set to binary 10 indicate that a computer is 
Apple lie and lie compatible, regardless of the value of bit 3. 



F.1 Overview 



[63 



J 



F.2 Memory Structure £- 

This section compares the memory organization of the Apple He 
with that ot the Apple II, II Plus, and lie. These machines differ 
in RAM space. ROM space, slot or port address space, and |* 

hardware page use. 

— e 



F.2. 1 Amount and Address Ranges of RAM 

The Apple II could have as little as 4K of RAM at the time of 
purchase, and could be upgraded to as much as 48K of RAM, ji 



r 



following a procedure described in the Apple II Reference 

Manual. 

The Apple II Plus has 48K of RAM ($0000 through SBFFF) as a 

standard feature. With the addition of an Apple Language Card. 

a 48K Apple II or II Plus could be expanded to have 64K of j— 

RAM. 

The Apple Me has a full 64K of RAM. The top 12K addresses ^ 

overlap with the ROM addresses SD000 through $FFFF. There Um 

is an additional bank -switched area of 4K from SD000 

through SDFFF. This arrangement is equivalent to an Apple II -— 

Plus with an Apple Language Card installed. A program selects ^ 

between the RAM and ROM address spaces and between the 

$Dxxx banks by changing soft switches located in memory. -— 

With an Extended 80-Column Text Card installed in its auxiliary — 
slot an Apple lie has an additional 64K of RAM available, 
although no more than half of the 128K of RAM space is 
available at any given time. Soft switches located in memory 
control these address space selections. 

The RAM in the Apple lie is equivalent to the RAM in an *-* 

Apple He with an Extended 80-column Card. 



&- 



54I Appendix F: Apple II Series Differences 



I 

l: 
l: 
l: 



F.2.2 Amount and Address Ranges of ROM 

The Apple II has 8K of ROM (SE000 through SFFFF), and the 
Apple II Plus has 12K of ROM (SD000 through SFFFF). Users 
can plug their own ROMs into the sockets provided. The 
on-board (as opposed to slot) ROM address range is from 
SD000 through SFFFF. 

The Apple He has 16K of ROM, of which it uses 15.75 K 
(addresses SC100 through SFFFF; page SCO addresses are for 
I/O hardware). ROM addresses SC300 through SC3FF (normally 
assigned to the ROM in a card in slot 3) and SC800 through 
SCFFF contain 80-column video firmware; ROM addresses 
SC100 through SC2FF and SC400 through SC7FF (normally 
assigned to the ROM on cards in slots 1, 2, 4, 5, 6 and 7) 
contain built-in self-test routines. 

A soft switch in RAM controls whether the video firmware or 
slot 3 card ROM is active. Invoking the self-tests with 
( a K controCH reset ) causes the self-test firmware to 
take over the slot ROM address spaces. 

The Apple lie ROM also uses the 15.75 K from SC100 through 
SFFFF. and its enhanced video firmware has the same entry 
point addresses as on the Apple He. However, there are only 
rudimentary built-in self-tests, and these do not pre-empt any 
port firmware space. 

In the Apple lie. addresses $C100 through SCFFF contain I/O 
and interrupt firmware, addresses SD000 through SF7FF contain 
the Applesoft BASIC Interpreter, and addresses SF800 through 
_j SFFFF contain the Monitor. 



L 

c 

i 

E 

L 



F.2 Memory Structure 1 65 



F.2.3 Peripheral-Card Memory Spaces 

Each Apple lie port has up to sixteen peripheral-card I/O space 
locations in main memory on the hardware page (beginning at 
location SCOsO + S80 for slot or port s), allocated in the 
standard Apple II series way (that is. beginning at location 
SCOsO H S80 for each slot s). 



The 1 28 bytes of peripheral-card RAM space or scratch-pad 
RAM (64 screen holes in main memory and their equivalent 
addresses in auxiliary memory) are reserved for use by the 
built-in firmware. It is extremely important for the correct 
operation of Apple He firmware that these locations not be 
altered by software except for the specific purposes described 
in Chapters 7, 8, and 9, and in Appendix E. 



F.2.4 Hardware Addresses 

The hardware page (the addresses from SC000 through SCOFF) 
controls memory selection and input/output hardware 
characteristics. All input and output (except video output) takes 
place at one or more hardware page addresses. For the sake of 
simplicity, this section presents only a general comparison 
between the Apple lie on the one hand, and the Apple II. II Plus, 
and lie on the other, with respect to most hardware page uses. 
However, for many characteristics, the Apple lie and lie work 
one way, while the Apple II and II Plus work another. 



! 

a 



The peripheral-card ROM space (page $Cs for slot s in the 
Apple II, II Plus, and lie) contains the starting and entry-point 
addresses for port s, but port routines are not limited to their ^ 

allocated $Cs pages. ^i^! 

The 2K-byte expansion ROM space from SC800 to SCFFF in 
the Apple lie is used by the enhanced video firmware and 
miscellaneous I/O and memory-transfer routines. 






'.< 



l56l Appendix F: Apple II Series Differences 



[ 



SCOOO to SCOOF 

«j| On all Apple II series computers, reading any one of these 

addresses reads the keyboard data and strobe. On the 
Apple lie and lie, writing to each of these addresses turns 

«J memory and display switches on and off. Writing to addresses 

~" SC006, SC007, SCOOA. and SCOOB performs ROM selection on 

the Apple He. Writing to these four addresses is reserved on the 

_j Apple lie. 

For reading the keyboard, use SCOOO; reserve SC001 through 
— SCOOF. 



SC0 10 to SC01F 

Mg On all Apple II series computers, writing to any one of these 

addresses clears the keyboard strobe. On the Apple lie and He. 
^ reading each of these addresses checks the status of a memory 

J or display switch, or the any-key-down flag. 

For clearing the keyboard strobe, use SC010; reserve SC011 

— through $C01F. 

Reading SC015 checks the SLOTCXROM switch on the 
_ Apple lie. but it resets the X-movement interrupt (XINT) on the 

\j Apple lie. Similarly, reading SC017 checks the SLOTC3ROM 

~" ' switch on the Apple He. but it resets the Y-movement interrupt 

^ (YINT) on the Apple He. 

— Reading SC019 checks the current state of vertical blanking 

(VBL) on the Apple lie, but it resets the latched vertical blanking 

— interrupt (VBLINT) on the Apple lie. 

i 
I 

I 

■ «4 F.2 Memory Structure f67~ 



I 



J 

1 

SC020 to $C02F _J 

On the Apple II, II Plus, and lie. reading any address $C02x U-^ 

toggles the cassette output signal. On the Apple lie. both 

reading from and writing to these locations are reserved. _ 



SC030 to SC03F 

On all Apple II series computers, reading an address of the 
form SC03x toggles the speaker. For full Apple II series 
compatibility, toggle the speaker using SC030. and reserve 
SC031 through SC03F. 

On the Apple He. writing to these addresses is explicitly 
reserved. 



SC040 to SC04F 

On the Apple II. II Plus, and lie, reading any address of the 
form SC04x triggers the Utility Strobe. The Apple lie has no 
Utility Strobe. 

On the Apple lie. addresses SC044 through SC047 are explicitly 
reserved, and reading or writing any address from SC048 
through SC04F resets both the X and Y interrupts (XINT and 
YINT). 



SC050 to SC05F 

Addresses SC050 through $C057 work the same on the 
Apple lie as on the Apple lie: they turn the TEXT. MIXED, 
PAGE2 and HIRES switches on and off. 



~qq\ Appendix F: Apple II Series Differences 



c 



3 



On the Apple He, addresses SC058 through SC05F turn the 
annunciator outputs on and off. On an Apple lie with a 
revision B main logic board, an Apple Extended 80-Column Text 
Card, and a jumper installed on the card, reading locations 
SC05E and SC05F set and clear double-high-resolution display 
mode. 

On the Apple lie, if the IOUDIS switch is on, both reading from 
and writing to addresses SC058 through $C05D are reserved, 
and addresses SC05E and $C05F set and clear 
double-high-resolution display (as on the Apple lie equipped as 
described in the preceding paragraph). If the IOUDIS switch is 
off, then addresses SC058 through SC05F control various 
characteristics of mouse and vertical blanking interrupts 
(Table 9-2). 

SC060 to SC06F 

On the Apple lie, writing to any address of the form SC06x is 
reserved, and reading addresses SC068 through SC06F is 
reserved. 

Reading addresses SC061 and SC062 is the same as on the 
Apple lie (switch inputs and Apple keys). Reading addresses 
SC064 and SC065 is the same as on all other Apple II series 
computers (analog inputs and 1). 

On the Apple He, address $C063 bit 7 is 1 if the mouse switch 
is not pressed, and if it is pressed, so that software looking 
for the shift-key mod (used on Apple II, II Plus, and lie with 
some text cards) will find it and display lowercase correctly. If 
by chance the mouse button is pressed when the software 
checks location $C063, it will appear that the shift-key mod is 
not present. 



K 

I "* F.2 Memory Structure 1 69 






SC090 to SCOFF 

On the Apple II, II Plus, and lie. each group of 16 addresses of 
the form $C080 + SsO is allocated to an interface card (if 
present) in slot s. 

On the Apple lie. addresses corresponding to slots 1, 2. 3. 4 
and 6 are allocated to a serial interface card, communication 
interface card. 80-column text card, mouse interface card, and 
disk controller card, respectively. All other addresses in this 
range are reserved. 



~70l Appendix F: Apple II Series Differences 



c 



b- 



On the Apple He, address SC060 is used for reading the state of 

the 80/40 switch; on the Apple II, II Plus, and lie. this address is .._- 

for reading cassette input. fer - 

The Apple He has two, rather than four, analog (paddle) inputs. 
Addresses SC066 and SC067 are used for reading the mouse 
X and Y direction bits. 

SC070 to SC07F y* 

On the Apple II. II Plus, and lie, reading from or writing to any 
address of the form $C07x triggered the (analog input) paddle 
timers. C? - 

On the Apple lie, only address SC070 is to be used for that one 
function. Addresses SC071 through SC07D are explicitly 
reserved. The results of reading from or writing to addresses 
SC07E and SC07F are described in Table 5-8. 

**- 

SC080 to SC08F 

On the Apple He and lie, accessing addresses in this range . — I 

selects different combinations of bank-switched memory banks. 
However, addresses SC084 through SC087 duplicate the 
functions of the four addresses preceding them, and addresses 
SC08C through $C08F do also. These eight addresses are S? - 

explicitly reserved on the Apple lie. 



•— 






"i 



F.2.5 Monitors 

The older models of the Apple II and Apple II Plus included a 
different version of the System Monitor from the one built into 
more recent models (and the Apple lie and lie). The older 
version, called the Monitor ROM, had the same standard I/O 
subroutines as the newer Autostart ROM, but a few of their 
features were different; for example, there were no arrow keys 
for vertical cursor motion. 

When you start the Apple He with a DOS or BASICS disk and it 
loads Integer BASIC into the bank-switched area in RAM. it 
loads the old Monitor along with it. When you type INT from 
Applesoft to activate Integer BASIC, you also activate this copy 
of the old Monitor, which remains active until you either type FP 
to switch back to Applesoft, which uses the new Monitor in 
ROM, or activate the 80-column firmware. 



i! 

r 

■ 4 F.2 Memory Structure 171 



F.3 I/O in General 



Apple He I/O is different from I/O on the Apple II. II Plus, and 
in three important respects: the possibility of direct memory 
access (DMA) transfers, the presence or absence of slots, and 
the presence or absence of built-in interrupt handling. 



1L. 



le - 



F.3. 1 DMA Transfers 

The Apple II. II Plus, and lie allow DMA transfers, because both 
the address and the data bus are available at the slots. No true 
DMA transfer is possible with the Apple lie because neither bus 
is available at any of the back-panel connectors. 

F.3.2 Slots Versus Ports 

The Apple II and II Plus have eight identical slots; the Apple lie 
has seven identical slots plus a 60-pin auxiliary slot for video, 
add-on memory and test cards. The Apple He has no slots; 
instead, it has built-in hardware and firmware that are functional 
equivalents of slots with cards in them (and back-panel 
connectors). These are called ports on the Apple He. 



Interrupts on the Apple lie are 
described in Appendix E. 



F.3.3 Interrupts 

The Apple He is the first computer in the Apple 
built-in interrupt-handling capabilities- 



Series to have 



I. 



72l 



Appendix F: Apple II Series Differences 



J 

3 



I 
E 

l: 



E 

I 

L 



FA Keyboard 



Both keyboard layout and character sets vary in the Apple II 
series computers. The major keyboard difference in the Apple 
Series is that the Apple lie and He have full ASCII keyboards, 
while the Apple II and II Plus do not. 



FA. 1 Keys 

The Apple II and II Plus have identical 52-key keyboards. The 
Apple lie and Apple lie keyboards have the same 63-key full 
ASCII keyboard layout, with new and repositioned keys and 
characters as compared to the Apple II and II Plus. While the 
Apple II and II Plus have a (rept) key, the He and lie have an 
auto-repeat feature built into each character key. 

Some Apple II and Apple II Plus machines have a slide switch 
inside the case, under the keyboard edge of the cover, for 
selecting whether or not (reset) works without [control ). On 
the Apple He and Apple lie. there is no choice: 
( control K reset) works, and (reset) alone does not. 



The Apple He and lie have an ( d ) and a (jij key; 
^3 tne Apple II and II Plus do not have these two keys. 



The captions on several keys — ( esc ) , (tab] , ( control ) , 
(shift) , (caps-lock) . ( delete ) , (return] , and ( reset ) — can vary: 
on the Apple II and II Plus some are abbreviated or missing; on 
the Apple lie all keycaps are lowercase italic; on international 
models, some captions are replaced by symbols (Appendix G). 



F.4 Keyboard 1 73 



The Apple He has two switches that the other models do not 
have. One switch is for changing between 40-column and 
80-column display, the other is for selecting keyboard layout 
(Sholes versus Dvorak on USA models), or both keyboard 
layout and character set (on international models). 

The position of the power-on light differs on the Apple II and 
II Plus. Apple lie. and Apple lie. The Apple He has a disk-use 
light as well. 



F.4.2 Character Sets 

The Apple II and II Plus keyboard character sets are the same. 
They are described in the Apple II Reference Manual. 

The Apple He and Apple He keyboard character sets are the 
same: full ASCII. The standard (Sholes) layout and key 
assignments are described in the Apple lie Reference Manual. 
The Dvorak layout and key assignments are described in 
Chapter 4 and Appendix G of this manual. 

To change between the two available keyboard layouts requires 
modification to the main logic board on the Apple He, but only 
toggling of the keyboard switch on the Apple He. 

Apple Computer. Inc. manufactures fully localized models 
(power supply and character sets) of both the Apple He and the 
Apple He. However, there are minor variations in keyboard 
layout, even among early and late productions models of the 
same machine. For further details, refer to Appendix G of this 
manual or to the Apple lie Supplement to the Owner's Manual. 



— i ^ 

74 I Appendix F: Apple II Series Differences — 



LT 



F.5 Speaker 



The Apple lie has two speaker features that the three previous 
models do not have. They are a two-channel, but monaural, 
mini-phone jack for headphones — which disconnects the 
internal speaker when something is plugged into it— and a 
volume control. 



F.6 Video Display 



L. 

i 
I 

■ 

I 
I 

I 



This section discusses the general differences between 
Apple lie video display capabilities and those of the other 
computers in the series. Note however that as new ROMs 
become available for the Apple Me, many differences between 
these two machines will vanish. 



F.6. 1 Character Sets 

The Apple II and II Plus display only uppercase characters, but 
they display them in three ways: normal, inverse, and flashing. 
The Apple He and He can display uppercase characters in all 
three ways, and they can display lowercase characters in the 
normal way. This combination is called the primary character 
set. 

The Apple lie and lie have another character set, called the 
alternate character set, that displays a full set of normal and 
inverse uppercase and lowercase characters, but can't display 
flashing characters. The primary and alternate character sets 
are described in Chapter 5. You can switch character sets at 
any time by means of the ALTCHAR soft switch, also described 
in Chapter 5. 

Flashing display must not be used with the enhanced video 
firmware active. Use it in 40-column mode with the enhanced 
video firmware turned off; otherwise, strange displays may 
result, such as MouseText characters appearing in place of 
uppercase letters. 

To be compatible with some software, you have to switch the 
Apple lie keyboard to uppercase by pressing ( caps lock") . 



F.6 Video Display 



75 



J 

1 

F.6.2 MouseText ^J 

MouseText characters (Chapter 5) are available on every fc-| 

Apple lie, and on any Apple lie that has had its ROMs | 

appropriately upgraded, if necessary. -^ 

F.6.3 Vertical Blanking . ^J 

A signal called vertical blanking indicates when a display device fe- - 

should stop projecting dots until the display mechanism returns 

from the bottom of the screen to the top to make another pass. 

During this interval, a program can make changes to display fe* 

memory pages, and thus provide a smooth, flicker-free 

transition to a new display. —— 

On the Apple lie, vertical blanking (VBL) is a signal whose level 
must be polled. (VBL is not available to software on the Apple II 
or II Plus.) On the Apple lie, vertical blanking is an interrupt 
(VBLINT) that occurs on the trailing edge of the active-low VBL 
signal. Programs intended to run on all Apple II series 
computers must take this difference into account. 



F.6.4 Display Modes 

All models have 40-column text mode, low-resolution graphics 
mode, high-resolution graphics mode, and mixed graphics and 
text modes. The Apple lie (revision B motherboard) with an 
Apple Extended 80-Column Text Card, and the Apple tic have 
double-high-resolution graphics mode also. 



~76l Appendix F: Apple II Series Differences 



-J 
"J 

— 

d 

j 



F7 Disk I/O 



F.8 Serial I/O 



The Apple II, II Plus, and lie can support up to six (four is the 
recommended maximum) disk drives attached in controller 
cards plugged into slots 6. 5. and 4. The Apple lie supports up 
to two disk drives: its built-in drive (treated as slot 6 drive 1), 
and one external disk drive (treated as slot 6 drive 2: also 
treated as slot 7 drive 1 under ProDOS) for external-drive 
startup purposes. 



The Apple lie serial ports (ports 1 and 2) are similar to Super 
Serial Cards installed in slots 1 and 2 of an Apple lie. The serial 
port commands are a slightly modified subset of Super Serial 
Card commands. This subset includes all the commands 
supported by the earlier Apple Serial Interface Card and 
Communication Card. 



=3 



n; 



F.8. 1 Serial Ports Versus Serial Cards 

There are several important differences between Apple lie serial 
ports and other Apple II series computers with serial cards 
installed in them. 

Apple He serial ports have no switches. Instead, initial values 
are moved from firmware locations into auxiliary memory when 
the power is turned on. Changes made to these values in 
auxiliary memory remain in effect until the power is turned off. 
Pressing (~5~ R control H reset ) does not change them. 

When the port itself is turned on (with an IN or PR command), 
the initial values in auxiliary memory are placed in the main 
memory screen holes assigned to the port. These 
characteristics can be changed by the port commands. The 
changed characteristics remain in effect until the port is turned 
off and then on again (with PR and IN commands). 



a 



F.8 Serial I/O 



\w 



F.8.2 Serial I/O Buffers 

The communication port firmware uses auxiliary memory page 8 
as an input and output buffer. By doing so, the firmware can 
keep up with higher baud rates. It can also hide data from the 
Monitor, Applesoft, and other system software. 

Programs written for the Apple He or lie can, of course, store 
information in auxiliary memory page 8. However, such 
information will be destroyed when the communication port is 
activated. 



d 



The command syntax for the Apple lie ports also differs from 

the syntax for serial cards. A separate command character. 

( control H X) or f conthol H T). must precede each individual ET - 

port command, whereas several commands to a serial card can 

be strung together between the command character and a 

carriage return character. — 

The letters used for some of the commands have been changed _^ 

from those used with the Super Serial Card (such as S instead ^ 
of B for sending a BREAK signal). Each serial port command 

letter is unique to simplify command interpretation. _ — 

Changing the command character from CONTROL-A to 
CONTROL-I, or vice versa, makes the Super Serial Card change 
from communication mode to printer mode and back; this is not _ 

the case with Apple lie serial ports. With the Apple lie. use the W* 

System Utilities Disk to change modes. 

Super Serial Card commands support several functions that 

Apple He serial port commands don't support: masking 

incoming line feed after carriage return; translating incoming 

characters, such as changing lowercase to uppercase (for the ^ 

benefit of the Apple H or II Plus); delaying after sending carriage 

return, line feed, or form feed; ignoring keyboard input, and so _^ 

on. U- 

Following a CONTROL-I nnnN command, the Apple lie 

automatically generates carriage return after nnn characters; 

with the Super Serial Card, you need to turn this on with "J - 

CONTROL-I C. 



*78l Appendix F: Apple II Series Differences 



- 

— 



F.9. 1 Mouse input 

The Apple lie provides built-in firmware support for a mouse 
connected to the DB-9 mouse and hand control connector. 
Apple lie mouse support includes mouse movement and button 
interrupts (and vertical blanking interrupts for synchronization 
with the display); Apple He mouse support relies on polling VBL 
instead of vertical blanking interrupts. 

As a result of how interrupts are handled on the two machines. 

§ the mouse firmware routine calls function somewhat differently 

for the Apple He and Apple lie. However, using the calls in the 
manner described in Chapter 9 ensures mouse support 

^ compatibility between the two machines. 

The ratio of mouse movement to cursor movement is different 
on the Apple He than it is on the Apple lie. 



l: 

L 

l -J 

l: 

fc 

i 

■ 

i 

E 

l: 

L 



F.9 Mouse and Hand Controls 



5 

^ 



The DB-9 back-panel connector on the Apple lie is used for 
both the mouse and hand controls. On the Apple He, the DB-9 
connector supports hand controls only. On the Apple lie, the 
mouse must use the connector on the interface card. 



F.9. 2 Hand Control input and Output 

The Apple II, II Plus, and lie have a 16-pin game I/O connector 
inside the case that supports three switch inputs, four analog 
(paddle) inputs, and four annunciator outputs. The Apple He and 
Apple lie have a DB-9 back-panel connector that supports the 
three switch inputs and two paddle inputs (plus two more on 
the internal GAME I/O connector of the Apple II, II Plus, 
and He). 

The Apple lie does not support the four annunciator outputs. 

The voltage-current curve for hand controls differs for the 
Apple lie compared with that of the Apple II. II Plus, and He. 
Compare Figure F-1 with Figure 11-42. This was done so the 
hardware would support identifiable mouse and hand control 
signals using the same circuits. 



F.9 Mouse and Hand Controls I 79 



Figure F-1. Apple II, II Plus, and lie Hand Control Signals 



Input Current 
(mAJ 




The paddle timing circuit on the Apple II Plus is slightly different 
than the one on the Apple lie and lie. On the Apple lie and lie 
the 100 ohm fixed resistor is betwen the NE556 discharge lead 
and the capacitor; the variable resistor in the paddle is 
connected directly to the capacitor. On the Apple II Plus, the 
capacitor is conected directly to the discharge lead, and the 
fixed resistor is in series with the paddle resistor. 



i 

a 
j 

3 



F. 10 Cassette I/O 



The Apple II, II Plus, and lie all have cassette input and output 
jacks, memory locations, and monitor support. The Apple lie 
does not. 



Appendix F: Apple II Series Differences 



i 



L 

I— J 

L 

c 

I— 

I 



t 



I 



F.7/ Hardware 



Besides the different microprocessors used in various models in 
the Apple II series (section F.1.1), there are important 
differences in power specifications and custom chips. 



F.11.1 Power 



The power supplies for the Apple II. II Plus, and lie are 
essentially the same. The floor transformer and voltage 
■- j converter for the Apple He have smaller capacity for current and 

I heat dissipation. Therefore, it is important to observe the load 

_ limits specified in each of the reference manuals. 

i— 14 

F. 1 1.2 Custom Chips 

i 

i 



-J The Apple lie custom chips (Memory Management Unit and 

Input/Output Unit) replaced dozens of Apple II Plus chips, and 

- added the functionality of dozens more. The Apple lie has 

^ custom MMU and IOU chips, too. but they represent different 

bonding options, and so their pin assignments are not 
compatible. 

I— In addition, the Apple He has a custom General Logic Unit 

(GLU), Timing Generator (TMG), and Disk Controller Unit (IWM). 
m m ~- s The Apple lie has two hybrid units (AUD and VID) for audio and 

"*3 video amplification. 

! 

■ ... 

i: 

5~*^ F11 Hardware HTi" 



I 



I 
I 



B) 

■D 

■n 

CD 

a 
a 

x 

CO 



I 



t 



This appendix repeats some of the keyboard information given 
in Chapter 4 for the two USA keyboard layouts for easy 
comparison with the other layouts available. Following these 
there is a composite table of the ASCII codes and the 
characters associated with them on all the models discussed. 



I G. 1 Keyboard Layouts and Codes 



i 



i: 



Each of the following subsections has a keyboard illustration 
and a table of the codes that result from the possible 
keystrokes. Note, however, that Table G-1 is the basic table of 
keystrokes and their codes. For simplicity, subsequent tables 
(up to Table G-6) list only the keystrokes and codes that differ 
from those in Table G-1. 

For example, pressing the (X) key produces a (hexadecimal 61); 
pressing (shift K g} produces uppercase A (hexadecimal 41); 
pressing ( control Ha} or ( control H shift H a") produces SOH 
(the ASCII Start Of Header control character, hexadecimal 01). 
You can tell that this key has the same effect on all keyboards, 
from the fact that nothing appears in Tables G-2 through G-7 
for that key. 

A quick way to find out which characters in the ASCII set 
change on international keyboards is to check Table G-7. In 
fact, only a few of them change. The pairing of characters on 
keys varies more. 



■ J± G.1 Keyboard Layouts and Codes 1 83 



I 



Note: On all but the French and Italian keyboards. ( caps-lock ) 
affects only keys that can produce both lowercase letters 
{with or without an accent) and their uppercase equivalents. 
With these keys, (caps-lock) down is equivalent to holding 
down (shift) , resulting in uppercase instead of lowercase. If 
a key produces only a lowercase version of an accented 
letter, then (caps-lock") does not affect it. 

On the French and Italian keyboards, (caps-lock] s hifts all the 
keys. Furthermore, on the French keyboard, when ( caps-lock ) 
is down, the (shift) key undoes the shifting. 

Note: The shapes and arrangement of keys in Figures G-1 
and G-2 follow the ANSI (American National Standards 
Institute) standard, which is used mainly in North and South 
America. The shapes and arrangement of keys in Figure G-3 
follows the ISO (International Standards Organization) 
standard used in Europe and elsewhere. 

The only differences between the ANSI and ISO versions of the 
USA keyboard are 



The shapes of three keys: the left (shift) key, (caps-lock ), 
and ( return ) . 

The resulting repositioning of two keys (© and Q) in 
Figures G-1 and G-3. 

For some countries, there are arrow symbols on ( tab ) , 

(caps-lock) , ( return ) , and the two (shift) keys (as shown in 

Figure G-3). f 



l=r- 

I- 

P 






84 I Appendix G: USA and International Models 



I 



c 



■ 



:a 



G. 1. 1 USA Standard (Sholes) Keyboard 

Figure G-1 shows the Standard (Sholes) keyboard as it is laid 
out for USA models of the Apple lie with the keyboard switch 
up. Table G-1 lists the ASCII codes resulting from all simple and 
combination keystrokes on this keyboard. 



Figure G-1. USA Standard or Sholes Keyboard (Keyboard Switch Up) 



/reset / yw/40 [jwo<mf 



m disk use i power 



est 


/ 



2 


I $ 

3 4 


5 


6 


& 
7 


* 
8 


( 

9 


J 



— 


+ 


■!----y 


tab 





W 


E 


ff 


T 


Y 


U 


1 





p 


[ 
[ 


J 
J 


1 
\ 


..,....,.. 


A 


s 


D 


F 


G 


H 


J 


K 


I 




II 
1 


'""■.■'■' 


Shift 


Z 


X 


C 


V 


B N 


M 


< 


> 


? 
1 


Sfllft 


caps 


\ 















« 


<■ 


■> 


i 


t 



^ 



a 



G.1 Keyboard Layouts and Codes 



f85~ 



Table G-t Keys and ASCII Codes. Codes are shown here in hexadecimal; to find the decimal equivalents, use 
Table G-7. 



Key 



rOELETl 

CD 



CD 

CD 

( RETURN 

G) 



SPACE 



,< 



■ > 

0) 

1! 

2@ 

3# 

4S 

5% 

8* 

7& 

ry 

9( 



Key Alone 
Hex 




CONTROL 


+ Key 


SHIFT 


Key 


Char 


Hex 


Char 


Hex 


Char 


7F 


DEL 


7F 


DEL 


7F 


DEL 


08 


BS 


08 


BS 


08 


BS 


09 


HT 


09 


HT 


09 


HT 


OA 


LF 


OA 


LF 


OA 


LF 


OB 


VT 


OB 


VT 


OB 


VT 


0D 


CR 


OD 


CR 


OD 


CR 


15 


NAK 


15 


NAK 


15 


NAK 


1B 


ESC 


1B 


ESC 


1B 


ESC 


20 


SP 


20 


SP 


20 


SP 


27 




27 




22 


- 


2C 


• 


2C 


• 


3C 


< 


2D 




1F 


US 


5F 


— 


2E 




2E 




3E 


> 


2F 


/ 


2F 


/ 


3F 


? 


30 





30 





29 


) 


31 


1 


31 


1 


21 


i 


32 


2 


00 


NUL 


40 


@ 


33 


3 


33 


3 


23 


# 


3-1 


4 


34 


4 


24 


$ 


35 


5 


35 


5 


25 


% 


36 


6 


1E 


RS 


5E 




37 


7 


37 


7 


26 


s 


38 


8 


38 


8 


2A 


• 


39 


9 


39 


9 


28 


< 


3B 




3B 


; 


3A 




3D 




3D 


= 


2B 


■f 


5B 


| 


IB 


ESC 


7B 


1 


5C 




1C 


FS 


7C 


1 


5D 


] 


ID 


GS 


7D 


1 


60 




60 




7E 





Both + 


<ey 


Hex 


Char 


7F 


DEL 


08 


BS 


09 


HT 


OA 


LF 


OB 


VT 


OD 


CR 


15 


NAK 


ID 


ESC 


20 


SP 


22 


ii 


3C 


< 


1F 


US 


3£ 


> 


3F 


? 


29 


) 


21 


! 


00 


NUL 


23 


# 


24 


s 


2b 


% 


1E 


RS 


26 


& 


2A 


• 


^e 


( 


3A 




2B 


+ 


1B 


ESC 


1C 


FS 


ID 


GS 


7E 





e 

t 

E 
i 






Appendix G; USA and International Models 



u 






















TfeMS G-r— Continued. Keys and ASCII Codes. Codes 


are shown 


here in hexadecimal; to find the decimal equivalents. 


L, 


use Table G-7. 


















i 




Key Alone 




CONTROL 


- Key 


SHIFT * 


<ey 


Both t 


Key 


Key 


Hex 


Char 


Hex 


Char 


Hex 


Char 


Hex 


Char 


A 


61 


a 


01 


SOH 


41 


A 


01 


SOH 


B 


62 


b 


02 


STX 


42 


B 


02 


STX 


C 


63 


c 


03 


ETX 


43 


C 


03 


ETX 


D 


64 


d 


0-1 


EOT 


44 


D 


04 


EOT 


E 


65 


e 


05 


ENQ 


45 


E 


05 


ENQ 


F 


66 


f 


06 


ACK 


■16 


F 


06 


ACK 




G 


67 


g 


07 


BEL 


4/ 


G 


07 


BEL 




H 


68 


h 


06 


BS 


■18 


H 


08 


BS 




1 


B9 


i 


09 


HT 


49 


i 


09 


HT 


J 


6A 


i 


0A 


LF 


4A 


J 


0A 


LF 


K 


6B 


k 


OB 


VT 


4B 


K 


0B 


VT 


L 


6C 


1 


0C 


FF 


4C 


L 


OC 


FF 


M 


6D 


m 


OD 


CR 


4D 


.',1 


0D 


CR 


N 


6E 


n 


0E 


so 


4E 


N 


0E 


so 







5F 





OF 


SI 


4F 


O 


OF 


SI 




P 


70 


P 


10 


OLE 


50 


P 


10 


DLE 


Ha 


o 


71 


q 


11 


DC1 


51 


Q 


11 


DC1 


H= 


R 


72 


r 


12 


DC2 


52 


R 


12 


DC2 




s 


73 


s 


13 


DC3 


53 


S 


13 


DC3 




T 


;-.: 


t 


■-! 


DC4 


■..: 


T 


14 


DC4 


r~3 


U 


75 


u 


1 5 


NAK 


55 


U 


IS 


NAK 


h-= 


V 


76 


V 


1 6 


SYN 


56 


V 


(6 


SYN 




w 


77 


w 


17 


ETB 


57 


w 


17 


ETB 




X 


78 


X 


18 


CAN 


58 


X 


18 


CAN 


r~: 


v 


79 


V 


19 


EM 


59 


Y 


19 


EM 


G 


Z 


7A 


z 


1A 


SUB 


5A 


z 


1A 


SUB 


fe 
























































r 5 




















L^ 

■ ~^"** 




















8 




















b 








































ba 




















^^ 




























G.1 Keyboard Layouts and Codes 






w 



G. 1.2 USA Simplified (Dvorak) Keyboard 

Figure G-2 shows the Dvorak layout of the USA keyboard. 
Characters are paired up on keys in exactly the same way as 
on the USA Standard keyboard; only individual key positions 
are changed. In fact, you can change the keycap arrangement 
to match Figure G-2, lock the keyboard switch in its down 
position, and have a working Dvorak keyboard. All keystrokes 
produce the same ASCII codes as those shown in Table G-1. 



Figure G.2. USA Simplified or Dvorak Keyboard {Keyboard Switch Down) 



I reset / ffso,w ytr>t>u#d 



I ' I 



esc 


1 

; 


2 


tt 


S 

4 


% 
5 


n 


& 

7 
/ 


8 


1 
9 


) 



[ 
1 


- 


gbto 




tab 


/ 






P 


Y 


1 
F 


6 


C 


R 


L 


I 


( 


1 
\ 




control 


A 





E 


U 


' ° 


H 


T 


N 


S 


- 






shrft 


: 


Q 


J 


K 


X 


B 


M 


W 


V 


I 


shift 




caps 

• 


* 











m 


#- 


-> 


i 


t 





p 
p 

e 

IS 



Appendix G: USA and International Models 



L 

E 
C 

t 



G. 7. J /SO Layouf 0/ i/S4 Keyboard 

Figure G-3 shows the layout of the keyboard of all ISO 
European keyboards (except the Italian keyboard) when the 
keyboard switch is up. All keystrokes produce the same ASCII 
codes as those shown in Table G-1 . 



Figure G-3. ISO Version of USA Standard Keyboard (Keyboard Switch Up) 



/reset / /J sow II BB 



/n /© 



err 


! [ © 
/ 2 


ft 
3 


S 
4 


5 


SI 

6 


& 

7 


* 
8 


( 
9 


1 



- u 


,;„:,:■. 


~M 





w 


E 


R 


T 


Y 


U 


1 





P 


r 
I 

I 


} 

] 




<3 


control 


A 


s 


D 


F 


G 


H 


J 


K 


L 




l 


\ 




■ '■ 


I 
\ 


Z 


X 


c 


V 


B 


rV 


M 


< 


> 


? 

I 


o 


o 










Cs 




A 


<~ 


•-. > 


4 


t 



=3 



£3 



G.1 Keyboard Layouts and Codes 



89 



G.1.4 English Keyboard 

With the keyboard switch up, the English model of the Apple lie 
keyboard layout is as shown in Figure G-3, and keystrokes 
produce the ASCII codes shown in Table G-1. 

With the keyboard switch down, the English model keyboard 
layout is as shown in Figure G-4. The change in ASCII code 
production (from that in Table G-1) is shown in Table G-2. 

The only changed character is the substitution of the British 
pound-sterling symbol (£) for the cross-hatch symbol (#) on the 
shifted 3-key. 



Figure G-4. English Keyboard (Keyboard Switch Down) 



/reset / JJ80/4Q JJUB 



/o /© 



esc 


1 
/ 


2 


£ 
3 


S 
4 


% 
5 


Si 

6 


& 
1 


* 
8 


( 
9 


) 



__ I + 


tubs 




tab 





W 


E 


ft 


T 


Y 


U 


/ 





P 


f 

f 


J 
J 




mlum 




crmm/l 


A 


s 


D 


F 


G 


H 


J 


K 


I 




it 


\ 






stuff 


\ 


Z 


X 


C 


V 


B 


N 


M 


< 


\ 


? 
I 


sMl 




caps 















m 


<— 




••-* 


i 


t 





Table G-2. English Keyboard Code Differences From Table G- 1 



Key 
3£ 



Key Alone 

Hex Char 

33 3 



CONTROL I Key 
Hex Char 

33 3 



SHIFT 
Hex 

23 



Key 

Char 



Both + Key 
Hex Char 

23 # 



E 



Ik 



* 



90 



Appendix G: USA and International Models 



I 



G. 1.5 French and Canadian Keyboards 

With the keyboard switch up, the French model of the Apple lie 
keyboard layout is as shown in Figure G-3, and the Canadian is 
as shown in Figure G-1. On both models, keystrokes produce 
the ASCII codes shown in Table G-1. 

Note: On the French keyboard, ( caps-lockI shifts to the 
upper characters on all keys. With ( caps-lock) on, (shift) 
"unshifts" to the lower character on any key pressed with it 

With the keyboard switch down, the French model keyboard 
layout is as shown in Figure G-5, and the Canadian model 
keyboard layout is as shown in Figure G-6. The changes in 
ASCII code production (from that in Table G-1) are shown in 
Table G-3. 



Figure G-5. French Keyboard (Keyboard Switch Down) 



met 



J u U" 



/■ /© 



LI 



M 



esc 


/ 
4 


2 

e 


3 

n 


4 
i 


5 
( 


6 
§ 


/ 
e 


8 

i 


9 
C 



a 


} 


- 


.:->'■■ 


-*f 


A 


Z 


E 


R 


T 


Y 


U 


1 





P 


t* 


it 
S 




*J 


conlntl 





s 


D 


F 

■ 


G 


H 


J 


K 


I 


M 


% 
u 


£ 




-.'- 


> 


W 


X 


c 


V 


B 


N 




: 


/ 


+ 


& 


o- 













u 


* 


-> 


i 


t 1 



E 



G.1 Keyboard Layouts and Codes 



IsT 



Figure G-6. Canadian Keyboard (Keyboard Switch Down) 



/"*« I u : I/™ 



/n /© 






#f s 



Gfetas 



',*.'.■ 



.: 









H 



■-r.'."'.' 



tftf 



; 



'■/ 



/ e 



,.■■:* 






cam 
bet 



Table G-3, French and Canadian Keyboard Code Differences From Table G- 1 





Key Alone 




CONTROL 


- Key 


SHIFT 


Key 


Both 


Key 


Key 


Hex 


Char 


Hex 


Char 


Hex 


Char 


Hex 


Chai 


&1 


26 


% 


26 


'. 


31 


I 


31 


1 


*2 


7B 


>■ 


7B 


6 


32 


2 


32 


2 


"3 


22 


■* 


22 


- 


33 


3 


33 


3 


'4 


27 


• 


27 


• 


34 


4 


34 


4 


(5 


28 


1 


28 


( 


35 


5 


35 


5 


§6 


5D 


§ 


1D 


GS 


36 


6 


1D 


GS 


67 


7D 


e 


7D 


e 


37 


7 


37 


7 


I6 


21 


! 


21 


i 


38 


8 


38 


8 


g9 


5C 


9 


1C 


FS 


39 


9 


1C 


FS 


ao 


40 


ft 


00 


NUL 


30 





00 


NUL 


)■ 


29 


) 


1B 


ESC 


5B 


■? 


IB 


ESC 




5E 




if 


RS 


7E 


- 


1E 


RS 


$' 


24 


S 


24 


$ 


2A 


• 


2A 


* 


11% 


7C 


u 


7C 


u 


25 


% 


25 


% 


c 


60 




60 




23 


c 


23 


£ 


<> 


3C 


< 


3C 


< 


3E 


> 


3E 


> 


? 


2C 




2C 




3F 


? 


3F 


? 




3B 




3B 




2E 




2E 




:■' 


3A 




3A 




2F 


/ 


2F 


/ 



~92l 



Appendix G: USA and International Models 



E 



L 



— ; 



~M 



-*4 



G.1.6 German Keyboard 

With the keyboard switch up, the German model of the Apple lie 
keyboard layout s as shown in Figure G-3, and keystrokes 
produce the ASCII codes shown in Table G-1. 

With the keyboard switch down, the German model keyboard 
layout is as shown in Figure G-7. The change in ASCII code 
production (from that in Table G-1) is shown in Table G-4. 



Figure G-7. German Keyboard (Keyboard Switch Down) 



^. J reset j jj jjii 



/n /© 



est 


i 




3 


S 
* 


{j 


t 

Qt 

6 


I 
7 


1 
8 


g 





8 


\ 

i 


delete 


-^ 





W 


E 


R 


T 


I 


U 


1 





P 


U 


* 

4- 




*J 


comi 


A 


S 


D 


F 


G 


H 


J 


K 


L 





A 







& 


} 
^ 


Y 


X 


c 


V 


B 


N 


M 


, 




— 


<? 


@ 










C 




m 


<-■ 


-* 


i 


t 



L 



.* 



I 



Table G-4. German Keyboard Code Differences From Table G- J 



CONTROL - Key 
Hex Char 





Key Alone 




Key 


Hex 


C 


2 


32 


2 


3§ 


33 


3 


54 


36 


6 


7/ 


37 


7 


8! 


38 


8 


9) 


39 


g 





30 


n 


B7 


7E 


(3 


u 


7D 


n 




2B 


I 





7C 


o 


A 


7B 


A 


#" 


23 


« 


<> 


3C 


< 


<i 


2C 
2E 


< 



32 
00 
36 
37 
38 
39 
30 
7E 
ID 
2B 
1C 
IB 
IE 
3C 
2C 
2E 



2 

NUL 
6 
7 

8 
9 


B 
GS 

+ 

FS 
ESC 
RS 

< 



SHIFT 

Hex 

22 

40 
26 
2F 
28 
29 
3D 
3F 
5D 
2A 
5C 
5B 
5E 
3E 
3B 
3A 



Key 
Char 



? 

U 

o 

A 

> 



Both 
Hex 

22 
00 
26 
2F 
28 
29 
30 
3F 
1D 
2A 
IG 
IB 
IE 
3E 
3B 
3A 



Key 



Char 



NUL 

& 

/ 



? 

GS 

• 

FS 

ESC 

RS 

> 



G.1 Keyboard Layouts and Codes 



93 



G. 1.7 Italian Keyboard 

With the keyboard switch down, the Italian model keyboard 
layout is as shown in Figure G-8. The change in ASCII code 
production (from that in Table G-1) is shown in Table G-5. 

With the keyboard switch up, the Italian model keyboard 
produces exactly the same ASCII codes for each key, but what 
is displayed differs for the ten characters shown in Table G-5 or 
Table G-7. 



Figure G-8. Italian Keyboard (Keyboard Switch Down) 



I reset / H jj:: 



/n /© 



esc 


ih 


3 

i 


4 

{ 


■ 


6 

e 


7 

) 


8 
£ 


9 

• 

a 



e 


— 


+ 


!■■■'':' 


-H 





z 


E 


R 


T 


y 


U 


1 





P 


i 


$ 




<3 




A 


s 


D 


F 


G 


H 


J 


K 


I 


M 


u 


5 




O 


< 


W 


X 


C 


V 


B 


N 






1 





^> 


O 










d 




• 


<- 


-> 


4- 


f 



£ 









94 



Appendix G: USA and International Models 



L 












c 


Taft/e G-5 


//aftan Keyboard Code Differences From Table G-1 








Key Alone 


CONTROL I Key 


SHIFT * Key 


Both + Key 


c 


Key 


Hex Char 


Hex Char 


Hex Char 


Hex Char 


Oil 


26 & 


26 & 


31 1 


31 1 


-2 


22 


22 


32 2 


32 2 


L 


*3 


27 


27 


33 3 


33 3 


(4 


28 ( 


28 ( 


34 4 


34 4 


55 


5C c 


1C FS 


35 5 


1C FS 


e6 


7D e 


7D e 


36 6 


36 6 


L 

■ 


>7 


29 ) 


29 ) 


37 7 


37 7 


E8 


23 E 


23 C 


38 8 


38 8 


&9 


7B a 


7B a 


39 9 


39 9 


60 


5D e 


1D GS 


30 


1D GS 


1 * 


7E I 


1E RS 


5E 


1E RS 


L 


$' 


24 S 


24 S 


2A 


2A 


u% 


60 u 


60 u 


25 % 


25 % 


§° 


40 § 


00 NUL 


5B 


1B ESC 


^■■■1 


<> 


3C < 


3C < 


3E 


3E > 




.? 


2C 


2C 


3F ? 


3F ? 




;. 


3B 


3B ; 


2E 


2E 


tT3 


:/ 


3A 


3A 


2F 


2F / 


i— ^ 


6! 


7C 6 


7C 


21 ! 


21 I 


a 












c 












1— il 












t 












E 












i - 












L 












E! 
















































G.1 Keyboard Layouts 


and Codes 


IS" 



G.1.8 Western Spanish Keyboard 

With the keyboard switch up. the Western (that is. American) 
Spanish model of the lie keyboard layout is as shown in Figure 
G-1, and keystrokes produce the ASCII codes shown in Table 
G-1. 

With the keyboard switch down, the Western Spanish model 
keyboard layout is as shown in Figure G-9. The change in ASCI 
code production (from that in Table G-1) is shown in Table G-6. 



*- 



— 



Figure G-9. Western Spanish Keyboard (Keyboard Switch Down) 



I 7 fl , flm 

/reset ] fj ■ [J:::: 



/n /© 



esc 


• 


2 


3 


S 
4 


% 

5 


/ 
6 


& 
7 


8 


< 
9 


i 




— 


i 


■ 


-H 





W 


[ 


'TV 


Y 


U 


1 





P 


o 
1 


\ 


I 


, .'.".',"' 


A 


" 


1 


F 


G 


H 


J 


K 


L 


N 




<J 


G 


I 


X 


c 


1/ 


B 


T T" 

N 


M 






1 


\> 




o 













m 


<^- 


-> 


i 


t 



Key 

2 
3E 

6& 
II 

8( 
9) 


? 

c 



N 
Qi 

: § 
<> 



















M 


rn Spanish Keyboard Code Differences From Table G- 1 










Key Alone 




CONTROL 


i Key 


SHIFT 


Key 


Both + Key 




Hex 


Char 


Hex 


Char 


Hex 


Char 


Hex 


Char 


32 


2 


32 


2 


22 


" 


22 


- 




33 


3 


33 


3 


23 


E 


23 


£ 


— 


36 


B 


00 


NUL 


26 


S 


00 


NUL 


U 


37 


7 


37 


7 


2F 


/ 


2F 


/ 




38 


B 


38 


8 


28 


( 


28 


I 




39 


9 


39 


9 


29 


) 


29 


I 


— 


30 





30 


o 


3D 


c 


3D 


— 


— 


27 


1 


27 


• 


3F 


? 


3F 


? 




BO 


• 


60 


■ 


5D 


6 


5D 


t 




7E 


- 


IE 


RS 


5E 




1E 


RS 


mm 


2B 


• 


IB 


ESC 


2A 


• 


1B 


ESC 


■ 


7C 


N 


1C 


FS 


5C 


N 


1C 


FS 




7D 


g 


7D 


C 


5B 


i 


5B 


i 




7B 


■-' 


00 


NUL 


40 


§ 


00 


NUL 


— 


3C 


< 


1E 


RS 


3E 


----- 


1E 


RS 




2C 




2C 




3B 


; 


3B 


: 




2E 




2E 


. 


3A 


: 


3A 


: 





96! 



Appendix G: USA and International Models 



L 

E 
C 

i— - 

L 
L 



■ 

I 



3 



-y 



I 



I 



t 



L 



G.2 4SC// Character Sets 



Table G-7 lists the ASCII (American National Standard Code for 
Information Interchange) codes that the Apple He uses, as well 
as the decimal and hexadecimal equivalents. Where there are 
differences between character sets, a circled number in the 
main table refers to a column in the lower part of the table. 



tag 

WM, G.2 ASCII Character Sets l97~ 



Table G-7. ASCII Code Equivalents 



ASCII DEC 


HEX 


ASCII 


DEC 


HEX 


ASCII 


DEC 


HEX 


ASCII 


DEC 


HEX 


NUL 00 


00 


SP 


32 


20 


•® 


64 


40 


*® 


96 


60 


SOH 01 


01 


I 


33 


21 


A 


6b 


41 


a 


97 


61 


STX 02 


02 




34 


22 


B 


66 


42 


b 


98 


62 


ETX 03 


03 


"(0) 


35 


23 


C 


67 


43 


c 


99 


63 


EOT 04 


04 


•CD 


36 


24 


D 


68 


44 


a 


100 


64 


ENQ 05 


05 


% 


37 


25 


E 


69 


4b 


e 


101 


65 


ACK 06 


06 


& 


38 


26 


F 


70 


46 


1 


102 


66 


BEL 07 


07 




39 


27 


G 


71 


47 


9 


103 


67 


BS 08 


08 


{ 


.hi 


28 


H 


72 


48 


h 


104 


68 


HT 09 


09 


) 


41 


29 


I 


73 


49 


1 


105 


69 


LF 10 


0A 




42 


2A 


J 


74 


4 A 


1 


106 


6A 


VT 11 


OR 


4 


43 


2B 


K 


75 


4B 


K 


107 


6B 


FF 12 


OC 




44 


2C 


L 


76 


4C 


1 


108 


6C 


CR 13 


ni ) 


- 


45 


2D 


M 


77 


4D 


m 


109 


6D 


SO 14 


OE 




46 


2E 


N 


78 


4E 


n 


110 


6E 


SI 15 


OF 


/ 


47 


2F 





re 


4h 





111 


61 


DLE 16 


10 





48 


30 


P 


HO 


50 


P 


112 


;u 


DC1 17 


11 


1 


49 


31 





81 


51 


q 


113 


71 


DC2 18 


12 


2 


50 


32 


R 


82 


52 


r 


114 


72 


DC3 19 


13 


3 


51 


33 


S 


83 


53 


s 


115 


73 


DC4 20 


14 


4 


52 


34 


T 


8-1 


54 


t 


116 


74 


NAK 21 


15 


5 


53 


35 


U 


85 


5b 


u 


117 


7r? 


SYN 22 


16 


6 


54 


36 


V 


86 


56 


V 


118 


76 


ETB 23 


17 


7 


55 


37 


w 


87 


57 


w 


119 


77 


CAN 24 


18 


8 


56 


38 


X 


88 


58 


X 


120 


'8 


EM 25 


19 


9 


57 


39 


Y 


89 


by 


y 


121 


7^ 


SUB 26 


1A 


• 


58 


3A 


z 


90 


5A 


■® 


122 


/A 


ESC 27 


1B 




59 


3B 


•(3) 


91 


bB 


123 


7B 


FS 28 


1C 


< 


60 


3C 


■CD 


92 


5C 


-<MJ 


124 


7C 


GS 29 


1D 


= 


61 


3D 


•<5) 


93 


5D 


■® 


125 


7D 


RS 30 


IE 




62 


3E 


•<S> 


94 


5E 


•<u> 


126 


7E 


US 31 


1F 


? 


63 


3F 


" 


95 


5F 


DEL 


127 


7F 


• 


® 


© 


® 


® c 


•> ® 


® 


® 


® 


® ® 


® 


Hexadecimal 


23 


24 


40 


5B 5 


C 5D 


5E 


60 


7B 


7C 70 


7E 


English (USA 


$ 


HI 


( 


] 






1 


) 


* 


English (UK) 


e 


S 


Ui 


I 


I 


- 




{ 


I I 


■ 


Deulsch 


# 


S 


§ 


A 


3 U 






a 


o u 


li 


Francals 


c 


s 


a 




5 § 


- 




e 


e 




Italiano 


£ 


$ 


§ 


■ 


c e 




U 


a 


o e 


i 


Espaholo 


e 


$ 


§ 


i 


R i 


- 






h c 


■ 






u. 



£ 



98 



Appendix G: USA and International Models 






■ G.3 Certifications 

In the countries where they are applicable, these certifications 
replace the USA FCC Class B notice printed on the inside front 
cover of this manual. The safety instructions apply to all 
countries. 

G.3.1 Radio Interference 

This product is designed to comply with specification 

VDE 0871/6.78, Radio Frequency Interference Suppression of 

Radio Frequency Equipment. Level B. 

"^* G. 3.2 Product Safety 

^ This product is designed to meet the requirements of safety 

standard IEC 380. Safety of Electrically Energized Office 
Machines. 



t 



i 

c 



G.3. 3 important Safety Instructions 



This equipment is intended to be electrically grounded. This 

I product is equipped with a plug having a third (grounding) pin. 

This plug will fit only into a grounding-type alternating current 
— ,_ outlet. This is a safetv feature. 



outlet. This is a safety feature. 

If you are unable to insert the plug into the outlet, contact a 
licensed electrician to replace the outlet and, if necessary, install 
a grounding conductor. 

Do not defeat the purpose of the grounding-type plug. 



G.3 Certifications 1 99 



G.4 Power Supply Specifications 



The basic specifications of the power supply furnished with the 
Apple lie for use in Europe and other countries having 50 Hz __ 

alternating current are shown in Table G-8. --. 

Table G-8. 50 Hz Power Supply Specifications 

Line voltage 199 to 255 VAC. 50 Hz u! 

Maximum input 

power consumption 25 W 

Supply voltage +15 V DC (nominal) 

Supply current 1 2 A (nominal) 



= 



- 
- 






Tool Appendix G: USA and International Models 



L 

E 



- 






t 
t 

I 

I 

I 

■ 

I 



I 

i 

I 

i 

L 



a 

o 

"o 





^ _ This appendix briefly discusses bits and bytes and what they 

— *M can represent. It also contains conversion tables for 

hexadecimal to decimal and negative decimal, for 

_ low-resolution display dot patterns, display color values, and a 

■ number of 8-bit codes. 

These tables are intended for convenient reference. This 
— j appendix is not intended as a tutorial for the materials 

j""^ discussed. The brief section introductions are for orientation 

only. 



L I H. 1 Bits and Bytes 

3 



This section discusses the relationships between bit values and 
their position within a byte. The following are some rules of 
thumb regarding the 65C02. 

• A bit is a binary digit; it can be either a or a 1. 

• A bit can be used to represent any two-way choice. Some 
choices that a bit can represent in the Apple lie are listed in 
Table H-1. 



H.1 Bits and Bytes h03 



Table H-1. What a Bit Can Represent 
Context Representing 



Place value 
Condition 

Position 

Position 

Beginning 

Data 

Parity 

End 

Communication 

state 

Neg. result? 
Overflow? 
BRK command? 
Decimal mode? 
IRQ interrupts 
Zero result? 
Carry required? 



Binary 


number 


Logic 




Any switch 


Any switch 


Serial transfer 


Serial transfer 


Serial transfer 


Serial transfer 


Serial transfer 


Preg. 


bit N 


P reg 


bit V 


P reg 


bit B 


P reg 


bit D 


Preg 


bit 1 


P reg 


bit Z 


P reg 


bitC 





False 

Off 
Cleart 

Start 
value 
SPACE 

BREAK 



No 

No 

No 

No 

Enabled 

No 

No 



1 x that power of 2 
True 

On 
Set 

Carrier (no information yet) 

1 value 

MARK 

Stop bit(s) 

Carrier 



Yes 
Yes 
Yes 
Yes 

Disabled (masked out) 

Yes 

Yes 



t Sometimes ambiguously termed reset . 



Bits can also be combined in groups of any size to 
represent numbers. Most of the commonly used sizes are 
multiples of four bits. 
Four bits comprise a nibble (sometimes spelled nybbte). 

One nibble can represent any of 16 values. Each of these 
values is assigned a number from through 9 and (because 
our decimal system has only ten of the sixteen digits we 
need) A through F. 
Eight bits (two nibbles) make a byte (Figure H-1). 



e 



104 



Appendix H: Conversion Tables 



i 



c 



E 

i: 

E 

i 

t 



Figure W- 1. Bits, Nibbles, and Bytes 












High Nibble 






Low Nibble 






MSB 








LSB 




7 


6 


6 


A 


3 


2 


1 





Hexadecimal 


$80 


S40 


$20 


(10 


S08 


$04 


$02 


SOI 


Decimal 


128 64 


32 


16 


8 


4 2 


1 


Binary 


Hexadecimal 


Decimal 








0000 


so 













0001 


Si 




1 








0010 


$2 




2 








0011 


S3 




3 








0100 


$4 




A 








0101 


S5 




5 








0110 


S6 




6 








0111 


S7 




1 








1000 


SB 













1001 


S9 




9 








1010 


SA 




10 








1011 


SB 




11 








1100 


sc 




12 








1101 


SD 




13 








1110 


SE 




M 








1111 


SF 




15 











• One byte can represent any of 16 x 16 or 256 values. The 
value can be specified by exactly two hexadecimal digits. 

• Bits within a byte are numbered from bit on the right to 
bit 7 on the left. 

• The bit number is the same as the power of 2 that it 
represents, in a manner completely analogous to the digits 

in a decimal number. 

• One memory position in the Apple lie contains one eight-bit 
byte of data, 

• How byte values are interpreted depends on whether the 
byte is an instruction in a language, part or all of an 
address, an ASCII code, or some other form of data. 
Tables H-6 through H-13 list some of the ways bytes are 
commonly interpreted. 



H.1 Bits and Bytes 



105 



Two bytes make a word. The sixteen bits of a word can 
represent any one of 256 x 256 or 65536 different values. 

The 65C02 uses a 16-bit word to represent memory 
locations- It can therefore distinguish among 65536 
(64K) locations at any given time. 

A memory location is one byte of a 256-byte page. The 
low-order byte of an address specifies this byte. The 
high-order byte specifies the memory page the byte is on. 



H.2 Hexadecimal and Decimal 



Use Table H-2 for conversion of hexadecimal and decimal 
numbers. 



F 


61440 


3840 


240 


15 


r 


57344 


3584 


224 


14 


D 


53248 


3328 


208 


1 3 


C 


49152 


3072 


192 


12 


B 


45056 


2816 


176 


n 


A 


40960 


2560 


160 


10 


9 


36864 


2304 


144 


9 


8 


32768 


2048 


128 


s 


7 


28672 


1792 


112 


7 


6 


24576 


1536 


96 


6 


5 


20480 


1280 


80 


5 


4 


16384 


1024 


6- 1 


4 


3 


12288 


768 


48 


3 


2 


8192 


512 


32 


2 


t 


4096 


256 


16 


1 



Examples: 

$3C = ? *FD47 = ? 

$30 = 48 SF000 = 61440 

$0C ■ 12 * D00 = 3328 

$ 40 = 64 

$ 7 - 7 



$3C - 60 



$FD47 ■ 64839 



1 06 I Appendix H: Conversion Tables 



J 



& 



er- 



Table H-2. Hexadecimal/Decimal Conversion 

Digit SxOOO 50x00 SOOxO SOOOx £LU 

To convert a hexadecimal number to a decimal number, find the ^ 
decimal numbers corresponding to the positions of each 
hexadecimal digit. Write them down and add them up. 



i 



b 



To convert a decimal number lo hexadecimal, subtract from the 
decimal number the largest decimal entry in the table that is 
less than it. Write down the hexadecimal digit (noting its place 
value) also. Now subtract the largest decimal number in the 
table that is less than the decimal remainder, and write down 
the next hexadecimal digit. Continue until you have zero left. 
Add up the hexadecimal numbers. 



Example: 








16215 = 


$ 9 






16215 - 

3927 - 

87 - 


12288 = 

3840 = 

80 = 

7 


3927 

87 
7 


12288 - $7000 

3840 * S FOO 

80 - $ 50 

7 * $ 7 



16215 * $7F57 



H.3 Hexadecimal and Negative Decimal 



If a number is larger than decimal 32767. Applesoft BASIC 
allows and Integer BASIC requires that you use the 
negative-decimal equivalent of the number. Table H-3 is set up 
to make it easy for you to convert a hexadecimal number 
directly to a negative decimal number. 



c 

i 
E 

*~4 



H.3 Hexadecimal and Negative Decimal M07 



Table H-3. Decimal to Negative Decimal Conversion 



Digit 

F 
E 

D 

C 

B 

A 

s 

8 
7 

6 

5 
4 

3 
2 
1 




SxOOO 


-4096 
-8192 
-12288 
■16384 
•20480 
-24576 
■28672 



SSOxOO 


-256 
-512 
-768 
-1024 
•1280 
-1536 
-1792 
-2048 
-2304 
-2560 
-2816 
-3072 
-3328 
-3584 
-3840 



SSOOxO 



-16 

-32 

-48 

-64 

-80 

-96 

-112 

-128 

-144 

-160 

-176 

-192 

-208 

-224 

-240 



SSOOOx 

-1 

-2 
■3 
-4 
-5 
■6 
-7 
■8 

-9 

-10 
-11 
-12 
-13 
-14 
-15 
-16 



To perform this conversion, write down the four decimal 
numbers corresponding to the four hexadecimal digits (zeros 
included). Then add their values (ignoring their signs for a 
moment). The resulting number, with a minus sign in front of it, 
is the desired negative decimal number. 



Example: 


$C010 


■ _ 9 


scooo 


-12288 


$ 000 


- 3840 


$ 10 


- 224 


$ 


16 


$C010 


-16368 



To convert a negative-decimal number directly to a positive 
decimal number, add it to 65536. (This addition ends up looking 
like subtraction.) 

Example: 

-151 - ♦ ? 

65536 + (-151) ■ 65536 - 151 = 65385 

To convert a negative-decimal number to a hexadecimal 
number, first convert it to a positive decimal number, then use 
Table H-2. 



108 



Appendix H: Conversion Tables 






t 



E 



HA Graphics Bits and Pieces 



Table H-4 is a quick guide to the hexadecimal values 
corresponding to 7-bit high-resolution patterns on the display 
screen. Since the bits are displayed in reverse order, it takes 
some calculation to determine these values. Table H-4 should 
make it easy. 

The >: represents bit 7. Zeros represent bits that are off; ones 
bits that are on. Use the first hexadecimal value if bit 7 is to be 
off, and the second if it is to be on. 

For example, to get bit pattern 00101110, use S3A; for 
10101110, use$BA. 



Table H-4. Hexadecimal Values tor High-Resolution Dot Patterns 



L 


Bil pattern 


(x 0) 


(x- 


r 


X0O0O000 


soo 


S80 


xOOOOOOl 


S40 


SCO 




xOOOOOlO 


S20 


SAO 


L— j 


X000001 1 


S60 


SEO 


Ml 


x0000l00 


S10 


S90 


L, 


X0000101 


$50 


SDO 


xoooono 


S30 


SBO 


xoooom 


S70 


SFO 


» m 


X0001000 


SOS 


$88 


|^ 


X0001001 


S48 


$C8 




X0001010 


S28 


SA8 


M-, 


xoooion 


S68 


SE8 


M3 


X0001100 


S18 


S98 


c 


xOOOHOl 


S58 


SD8 


xooomo 


S38 


SB8 


xooonn 


S78 


SF8 


i 


X0010000 


S04 


S84 


xOOlOOOl 


S44 


SC4 




xOO 10010 


S24 


SA4 


M^ 


X0010011 


S64 


SE4 


a— 


X0010100 


S14 


S94 


L_ 


X0010101 


S54 


$D4 


X0010110 


S34 


$B4 


xooiont 


$74 


$F4 




X0011000 


soc 


$8C 


l: 


X0011001 


S4C 


sec 


X0011010 


S2C 


SAC 


X0011011 


S6C 


SEC 


S 


xoomoo 


S1C 


S9C 


X0011101 


S5C 


SOC 




X0011110 


S3C 


SBC 


N 


X0011111 


S7C 


SFC 


E 













Bits in Data Byte 







1 


2 3 


4 


5 


6 



Dots on Graphics Screen 



Ml 



H.4 Graphics Bits and Pieces 



109 



Table H~4— Continued. Hexadecimal Values for High-Resolution Dot Patterns 
Bit pattern (x = 0) (x 1) 



x01 00000 


S02 


$82 


xO 100001 


$42 


$C2 


xO 1000 10 


S22 


SA2 


X0100011 


S62 


SE2 


x0100100 


S12 


$92 


X0100101 


S52 


$D2 


X0100110 


S32 


$B2 


X0100111 


$72 


$F2 


X0101000 


SOA 


$8A 


X0101001 


$4 A 


$CA 


X0101010 


S2A 


$AA 


x0101011 


S6A 


$EA 


X0101100 


S1A 


$9A 


x0101101 


S5A 


$DA 


X0101110 


S3A 


$BA 


X0101111 


S7A 


SFA 


xOl 10000 


S06 


S86 


x01 10001 


S46 


$C6 


X0110010 


S26 


SA6 


x01 10011 


S66 


SE6 


x01 10100 


$16 


S96 


x01 10101 


S56 


SD6 


X0110110 


S36 


SB6 


X0110111 


S76 


SF6 


xomooo 


SOE 


S8E 


x01 11001 


S4E 


$CE 


xomoio 


S2E 


$AE 


x01 11011 


S6E 


SEE 


xonnoo 


S1E 


$9E 


X0111101 


S5E 


SDE 


X0111110 


S3E 


$BE 


x01 11111 


S7E 


$FE 


x 1000000 


S01 


S81 


x 1000001 


S41 


$C1 


x 1000010 


$21 


$A1 


x1 000011 


S61 


SE1 


x1 0001 00 


$11 


$91 


X1000101 


$51 


$D1 


X1000110 


$31 


$B1 


X1000111 


$71 


$F1 


x1 001 000 


$09 


$89 


X1001001 


$49 


$C9 


X1001010 


$29 


$A9 


X1001011 


$69 


SE9 


X1001100 


$19 


S99 


X1001101 


S59 


$D9 


X1001110 


$39 


SB9 


X1001111 


S79 


SF9 






1 1 I Appendix H: Conversion Tables 



£ 



m 






Table H-4— Continued. Hexadecimal Values for High-Resolution Dot Patterns 



£ 



=3 

=3 
=3 



E 

E 

E 



=3 



Bit pattern 


(x = 0) 


(x 


x1 01 0000 


$05 


$85 


X1010001 


$45 


$C5 


X1010010 


$25 


$A5 


x1 01 0011 


$65 


$E5 


X1010100 


$15 


S95 


X1010101 


$55 


SD5 


X1010110 


S35 


SB5 


X1010111 


S75 


SF5 


X1011000 


$0D 


S8D 


X1011001 


S4D 


SCD 


X1011010 


S2D 


SAD 


X1011011 


S6D 


SED 


X1011100 


S1D 


$9D 


X1011101 


$5D 


SDD 


X1011110 


S3D 


SBD 


X1011111 


$7D 


$FD 


x1 100000 


$03 


$83 


x1 100001 


$43 


SC3 


x1 100010 


$23 


$A3 


X1100011 


S63 


$E3 


x1 100100 


S13 


S93 


X1100101 


S53 


$D3 


X1100110 


S33 


$83 


X1100111 


S73 


$F3 


X1101000 


SOB 


S8B 


xl 101001 


$4B 


SCB 


X1101010 


S2B 


SAB 


X1101011 


S6B 


SEB 


X1101100 


$1B 


S9B 


X1101101 


$5B 


SOB 


X1101110 


$3B 


SBB 


x1 101111 


$7B 


SFB 


x1 110000 


$07 


$87 


x1 110001 


$47 


$C7 


x1 110010 


$27 


$A7 


x1 110011 


$67 


SE7 


x1 110100 


$17 


S97 


X1110101 


S57 


SD7 


X1110110 


S37 


SB7 


X11101 11 


$77 


$F7 


x11 11000 


$0F 


S8F 


xl 1 1 1001 


S4F 


SCF 


X1111010 


$2F 


SAF 


xl 11 101 1 


$6F 


SEF 


X1111100 


$1F 


S9F 


X1111101 


$5F 


SDF 


x1 111110 


$3F 


$BF 


X1111111 


$7F 


$FF 



H.4 Graphics Bits and Pieces 1111 



H.5 Peripheral Identification Numbers 



Many Apple products now use Peripheral Identification Numbers 

(called PIN numbers) as shorthand for serial device 

characteristics. The Apple II Series System Utilities Disk 

presents a menu from which to select the characteristics of, 

say, a printer or modem. From the selections made, it generates ^ 

a PIN for the user. Other products have a ready-made PIN that jj^ 

the user can simply type in. 

Table H-5 is a definition of the PIN number digits. When - 

communication mode is selected, the seventh digit is ignored. _ 

Example: _ 

252/1111 means: *" 

Communication mode — m 

8 data bits. 1 stop bit U- 

300 baud (bits per second) 

No parity 



Do not echo output to display 
No linefeed after carriage retu 
Do not generate carriage returns 



No linefeed after carriage return r* 



u. 



VJYl Appendix H: Conversion Tables 



E 

l: 

fc 

! 



7ab/e H-5. F//V Numbers 



1 - Printer Mode 

2 = Communication Mode 

1 - 6 data bits, 1 stop bit 

2 = 6 data bits. 2 stop bits 

3 « 7 data bits. 1 stop bit 

4 = 7 data bits, 2 stop bits 

5 = 8 data bits. 1 stop bit 

6 = 8 data bits, 2 stop bits 

1 = 110 bits per second 

2 = 300 bits per second 

3 = 1200 bits per second 

4 = 2400 bits per second 

5 - 4800 bits per second 

6 = 9600 bits per second 

7 = 19200 bits per second 



1 = No parity 

2 - Even parity (total on = even) 

3 - Odd parity (total on - odd) 

4 = MARK parity (parity bit = 1) 

5 = SPACE parity (parity bit = 0) 

1 = Do not echo output on screen 

2 = Echo output on screen 

1 = Do not generate LF alter CR 

2 = Generate LF alter CR 

1 Do not generate CR * 

2 = Generate CR alter 40 characters 

3 Generate CR alter 72 characters 

4 Generate CR alter 80 characters 

5 ■ Generate CR alter 132 characters 



E 


; 




" 


X 

















3 



' II you select Communication Mode, then seventh digit must equal 1 
This value is supplied automatically when you use the UUD. 



H.5 Peripheral Identification Numbers 



113 



H.6 Eight-Bit Code Conversions 



i- 



Tables H-6 through H-13 show the entire ASCII character set 

twice: once with the high bit off, and once with it on. Here is 

how to interpret these tables. jU- 

• The Binary column has the 8-bit code for each ASCII 
character. 

• The first 128 ASCII entries represent 7-bit ASCII codes plus 
a high-order bit of (SPACE parity or Pascal)— for example, 
01001000 for the letter H. ^ 

• The last 128 ASCII entries (from 128 through 255) represent 

7-bit ASCII codes plus a high-order bit of 1 (MARK parity or — 
BASIC)— for example, 11001000 for the letter H. \L- 

• A transmitted or received ASCII character will take 
whichever form (in the communication register) is 
appropriate if odd or even parity is selected— for example. 
11001000 for an odd-parity H. 01001000 for an even-parity 

H. £ 

• The ASCII Char column gives the ASCII character name. 

• The Interpretation column spells out the meaning of special 
symbols and abbreviations, where necessary. 

• The What to Type column indicates what keystrokes 

generate the ASCII character (where it is not obvious). The £- 

numbers between columns refer to footnotes. 

• The columns marked Pri and Alt indicate what displayed 
character results from each code when using the primary or 
alternate display character set, respectively. Boldface is 

used for inverse characters; italic is used for flashing ^ 

characters. 

Note that the values S40 through S5F (and SCO through _^ 

$DF) in the alternate character set are displayed as C - 
MouseText characters (Figure 5-1) if the firmware is set to 

do so (section 5.2.2), or if the firmware is bypassed. — * 



c 



1141 Appendix H: Conversion Tables 



E 

l: 



L 

■ — i J 

l: 

L 

l: 

L 

■ 

l: 



Note: The primary and alternate displayed character sets in 
Tables H-6 through H-13 are the result of firmware mapping. 
The CHARGEN ROM actually contains only one character 
set. The firmware mapping procedure is described in 
section 3.36. 



Table H-6. Control Characters. High Bit Off 









ASCII 










Binary 


Dec 



Hex 

$00 


Char 

NUL 


Interpretation 

Blank (null) 


What to Type 


Prl 
Q 


Ait 


0000000 


. ::OMRO". - ■■ 


(<y 


0000001 


1 


S01 


SOH 


Start of Header 


( CONTROL H A ) 


A 


A 


0000010 


2 


S02 


STX 


Start ol Text 


( CONTROL H B ) 


B 


B 


000001 1 


3 


S03 


ETX 


End of Text 


( CONTROL H C ) 


c 


C 


0000100 


4 


S04 


EOT 


End of Transm. 


( CONTROL H ) 


D 


D 


0000101 


5 


S05 


ENQ 


Enquiry 


{ CONTROL H E ) 


E 


E 


0000110 


6 


S06 


ACK 


Acknowledge 


(CONTROLHF) 


F 


F 


00001 1 1 


7 


$07 


BEL 


Bell 


I CONTROL H G ) 


G 


G 


0001000 


6 


$08 


BS 


Backspace 


I CONTROL H H ) 


H 


H 




9 


$09 


HT 


Horizontal Tab 


or O 


1 




0001001 


[ CONTROL M 1 ) 


1 












or I TAB ) 






0001010 


10 


S0A 


LF 


Ltne Feed 


(CONTROLMJ) 

or (jj 


J 


J 


0001011 


11 


SOB 


VT 


Vertical Tab 


...u-.iHOL i-; K : 
or© 


K 


K 


0001100 


12 
13 


$0C 
$0D 


FF 

CR 


Form Feed 
Carriage Return 


(CONTROLHL) 


L 
M 


L 


0001101 


[ CONTROL H M ) 


M 












Or . RETURN 1 






0001110 


14 


S0E 


SO 


Shift Out 


[ CONTROL H N | 


N 


N 


0001 1 1 1 


15 


S0F 


SI 


Shift In 


. CO'JTRQi M O i 





O 


0010000 


16 


S10 


DLE 


Data Link Escape 


[ CONTROL HP) 


p 


P 


0010001 


17 


S11 


DC1 


Device Control 1 


1 CONTROL H O ) 


Q 


Q 


0010010 


16 


S12 


DC2 


Device Control 2 


f CONTROL H,R) 


R 


R 


0010011 


19 


$13 


DC3 


Device Control 3 


( CONTROL H S | 


S 


s 


0010100 


20 


$14 


DC4 


Device Control 4 


{ CONTROL H T ] 


T 


T 


0010101 


21 


$15 


NAK 


Neg. Acknowledge 


( CONTHOL H U ] 

Of " - ; 


U 


u 


0010110 


22 


$16 


SYN 


Synchronization 


I CONTROL M V J 


v 


V 


0010111 


23 
24 


$17 
$16 


ETB 
CAN 


End of Text Blk. 
Cancel 


(CONTROLHW) 


w 

X 


w 


0011 000 


( CONTROL H X J 


X 


0011001 


25 


$19 


EM 


End of Medium 


( CONTROL H f ) 


V 


Y 


0011010 


26 


S1A 


SUB 


Substitute 


( CONTROL M Z J 


Z 


Z 


0011011 


27 


S1B 


ESC 


Escape 


( CONTROL H 1 J 
or fESC") 


f 


1 


0011100 


28 


$1C 


FS 


File Separator 


( CONTROL H i ) 


\ 




0011101 


29 


$1D 


GS 


Group Separator 


f CONTROL H 11 


] 


i 


0011110 


3D 


$1E 


RS 


Record Separator 


I CONTROL H * ) 






0011111 


31 


S1F 


US 


Unit Separator 


I CONTROL H 1 


- 


- 



H.6 Eight-Bit Code Conversions 



115 



Table H-7. Special Characters, High Bit Off 









ASCII 




Binary 


Dec 


Hex 


Char 


Interpretation 


0100000 


32 


S20 


SP 


Space 


0100001 


33 


S21 


i 




0100010 


34 


$22 


" 




0100011 


35 


S23 


# 




0100100 


36 


S24 


s 




0100101 


37 


S25 


% 




0100110 


38 


S26 


S 




0100111 


39 


S27 




Closing Quole 


0101000 


40 


S28 


( 




0101001 


•ii 


S29 


) 




0101010 


42 


S2A 


• 




0101011 


43 


S2B 


+ 




0101100 


44 


S2C 


■ 


Comma 


0101101 


45 


S2D 


- 


Hyphen 


0101110 


46 


S2E 




Period 


0101111 


47 


S2F 


/ 




0110000 


48 


S30 







0110001 


49 


S31 


1 




0110010 


SO 


S32 


2 




0110011 


51 


S33 


3 




0110100 


52 


S34 


4 




0110101 


53 


S35 


5 




0110110 


54 


S36 


6 




0110111 


55 


$37 


1 




0111000 


56 


$38 


6 




0111001 


57 


$39 


9 




0111010 


58 


$3A 






0111011 


59 


$3B 


; 




0111100 


60 


$3C 






0111101 


61 


S3D 






0111110 


82 


S3E 


> 




0111111 


83 


$3F 


? 





What to Type 
SPACE bar 



Pn 



AH 



-l 



tf 


# 


s 


s 


% 


% 


& 


& 


( 


1 


> 


) 



/ 


/ 












1 


1 


— 


2 


2 


L~ 


3 


3 




d 


4 




5 


5 


m & 


6 


G 


jU 


7 


7 







8 




9 


9 


—^ 






k 


t 


; 




< 


< 






= 


4^1 


"-- 


-■ 




? 


? 


*■ 



116 



Appendix H: Conversion Tables 



£ 
£ 
£ 



















-— 


Table H-8. 


Uppercase 


Characters 


High 


Bit Off 






— 








ASCII 






— i 


Binary 


Dec 


Hex 


Char 


Interpretation What to Type 


Pn 


Alt 




1000000 


„.; 


S40 


@ 




@ 


i 


=3 


1000001 


65 


S41 


A 




A 


1000010 


66 


$42 


B 




B 


k 


1000011 


67 


S43 


c 




C 


z 




1000100 


68 


$44 


D 




D 


■y 


53 


1000101 
1000110 


69 

70 


$45 
$46 


E 
F 




E 
F 


a 


—~ > 


1000111 


71 


$47 


G 




G 


K. 




1001000 


72 


$48 


H 




H 


- 


1001001 


73 


$49 


I 




t 


I 


U-J 


1001010 


74 


$4A 


J 




J 




1001011 


75 


S4B 


K 




K 


t 




1001100 


76 


$4C 


L 




L 




— 


1001101 


77 


S4D 


M 




M 


♦J 


3 


1001110 


78 


$4E 


N 




IV 


■ 




1001111 


79 


$4F 










at 




1010000 


BO 


$50 


p 




P 


* 


- 


1010001 


a; 


$51 










i 


U— J 


1010010 


82 


$52 


R 




fl 


— 


1010011 


83 


$53 


s 




s 


~~ 




1010100 


84 


$54 


T 




J 


L 


... 


1010101 


85 


$55 


U 




u 


-> 


J 


1010110 


86 


S56 


V 




V 


■ 


— 


1010111 


87 


$57 


w 




W 


if 




1011000 


Be 


S58 


X 




X 


C 


— . 


1011001 


89 


$59 


Y 




Y 


3 


=3 


1011010 


90 


$5A 


Z 




2 


1 


1011011 


91 


$5B 


I 


Opening Bracket 


/ 


♦ 




1011100 


92 


S5C 


\ 


Reverse Slant 




_ 


~~, 


1011101 


93 


$5D 


I 


Closing Bracket 


/ 


* 


u2 


1011110 


94 


$5E 




Caret 




3 




1011111 


95 


$5F 


- 


Underline 


— 


1 


^_ 
















L-Jj 
















h 
































E 
















E 
















\^ 










H.6 Eight-Bit Code Conversions 




1117 



Table H-9. Lowercase Characters. High Bit Off 









ASCII 




Binary 


Dec 


Hex 


Char 


Interpretation 


1100000 


96 


S60 


• 


Opening Quote 


1100001 


97 


$61 


B 




1100010 


98 


$62 







1100011 


99 


S63 


c 




1100100 


100 


$64 


d 




1100101 


101 


S65 


e 




1100110 


102 


S66 


f 




1100111 


103 


$67 


g 




1101000 


104 


$68 


h 




1101001 


105 


$69 


i 




1101010 


106 


S6A 


i 




1101011 


107 


S6B 


k 




1101100 


108 


S6C 


1 




1101101 


109 


$6D 


m 




1101110 


110 


$6E 


n 




1101111 


111 


$6F 







1 1 1 0000 


112 


S70 


i 1 




1110001 


113 


$71 


q 




1110010 


114 


S72 


r 




1110011 


115 


$73 


^ 




1110100 


116 


$74 


t 




1110101 


117 


$75 


u 




1110110 


118 


$76 


V 




1110111 


119 


S77 


W 




1111000 


120 


S78 


X 




1111001 


121 


$79 


y 




1111010 


122 


$7A 


z 




1111011 


123 


$7B 


1 


Opening Brace 


1111100 


124 


S7C 


1 


Vertical Line 


1111101 


125 


$7D 




Closing Brace 


1111110 


126 


S7E 


" 


Overline (Tilde) 


1111111 


127 


$7F 


DEL 


Delete/Rubout 



What to Type 



Pri 



+ 



Alt 



a 
b 

c 

d 

I 

B 

h 
i 
I 

N 
I 

m 
n 

o 

P 

q 

r 

s 

t 

u 

V 

w 

X 

v 



DEL 



£ 



118 



Appendix H: Conversion Tables 



u 




















TaWe W-tO. 


Control Characters, 


High Bit On 








bn 








ASCII 










l~4 


Binary 


Dec 


Hex 


Char 


Interpretation 


What to Type 


Pri 


Alt 




1 ooooooo 


128 


$80 


NUL 


Blank (null) 


: CONTROL M S I 


Cgp 


© 


p 


10000001 


129 


S81 


SOH 


Start of Header 


. CONTROL H A I 


A 


A 


10000010 


130 


S82 


STX 


Start of Text 


: CONTRG. -I B : 


B 


B 




10000011 


131 


S83 


ETX 


End of Text 


( CONIROLHC) 


C 


C 




10000100 


132 


S84 


EOT 


End of Transm. 


. CONTROL -i D : 


D 


D 


l"3 


10000101 


133 


S85 


ENQ 


Enquiry 


. CONTROl -. t 


E 


E 


1— 1 


10000110 


134 


$86 


ACK 


Acknowledge 


.-. NtHO. ■'■ i- 


F 


F 




10000111 


135 


$87 


BEL 


Bell 


; CONTROL -I G '■ 


G 


G 




10001000 


136 


$88 


BS 


Backspace 


| CONTROL H H ) 


H 


H 


p 


10001001 


137 


S89 


HT 


Horizontal Tab 


or GD 

( CONTROL HT) 

or (TAB) 


1 


1 




10001010 


138 


S8A 


Lf- 


Line Feed 


( CONTROL H J ) 


J 


J 


P 


10001011 


139 


S6B 


VT 


Vertical Tab 


or© 

( CONTROL H"X~1 

or .-■ 


K 


K 




10001100 


140 


S8C 


FF 


Form Feed 


( CONTROL HL) 


L 


L 


b-i 


10001101 


141 


$8D 


CR 


Carriage Return 


I CONTROL K M 1 


M 


M 


J—a 


Or ( RETURN ) 




10001110 


142 


$8E 


SO 


Shift Out 


I CONTROL H N ) 


N 


N 




10001111 


143 


$8F 


SI 


Shift In 


1 CONTROL M O ) 





O 


■=3 


10010000 


144 


$90 


DLE 


Data Link Escape 


( CONTROL H P ) 


P 


P 


10010001 


145 


S91 


DC1 


Device Control 1 


1 CONTROL H Q ) 


Q 


Q 




10010010 


146 


$92 


DC2 


Device Control 2 


[ CONTROL H R ) 


R 


R 




10010011 


147 


$93 


DC3 


Device Control 3 


( CONTROL H S ) 


s 


S 


p 


10010100 


148 


$94 


DC4 


Device Control 4 


( CONTROL H T ) 


T 


T 


10010101 


149 


$95 


NAK 


Neg. Acknowledge 


CONTROL i- U 1 


U 


u 














orQ 








10010110 


150 


S96 


SYN 


Synchronization 


( CONTROL H V ) 


V 


V 


La 


10010111 


151 


$97 


ETB 


End of Text Blk. 


1 CONTROl - .'. I 


w 


w 


10011000 


152 


$98 


CAN 


Cancel 


( CONTROL H X ) 


X 


X 


^™ 


10011001 


153 


$99 


EM 


End of Medium 


I CONTROL i-i. ■ 1 


Y 


Y 




10011010 


154 


$9A 


SUB 


Substitute 


I CONTROL M Z ) 


z 


z 


i .. 


10011011 


155 


S9B 


ESC 


Escape 


1 CONTROL Kf 1 


I 


1 


i— j 












or ( esc ) 








10011100 


156 


S9C 


FS 


File Separator 


( CONTROL M ) 


\ 


\ 




10011101 


157 


$9D 


GS 


Group Separator 


[ CONTROL H 1 ) 


1 


1 


! — j 


10011110 


158 


$9E 


RS 


Record Separator 


; CONTROl -i ■ 






L -d 


10011111 


159 


$9F 


US 


Unit Separator 


( CONTROL H - ) 


- 


- 


i— j 
1 " 


















L 


















i ■ 


















h 


















" 


















L 

b 
























H.6 


Eight-Bit Code Conversions 






1119 



Table H-11 


Special Characters, 


High Bit On 








ASCII 




Binary 


Dec 


Hex 


Char 


Interpretation 


10100000 


160 


SAO 


SP 


Space 


10100001 


161 


SA1 


! 




10100010 


162 


SA2 






10100011 


163 


SA3 


# 




10100100 


164 


$A4 


s 




10100101 


165 


SA5 


% 




10100110 


166 


SA6 


8 




10100111 


167 


SA7 




Closed Quote 
(acute accent) 


10101000 


168 


SAB 


( 




10101001 


169 


SA9 


I 




10101010 


170 


SAA 


• 




10101011 


171 


SAB 


f. 




10101100 


172 


SAC 


. 


Comma 


10101101 


173 


SAD 


- 


Hyphen 


10101110 


174 


SAE 


. 


Period 


10101111 


175 


SAF 


t 




10110000 


176 


S80 







10110001 


177 


SB1 


1 




10110010 


178 


SB2 


2 




10110011 


179 


SB3 


3 




10110100 


180 


SB4 


4 




10110101 


181 


SB5 


5 




10110110 


182 


SB6 


6 




10110111 


183 


SB7 


7 




10111000 


184 


SB8 


8 




10111001 


185 


SB9 


9 




10111010 


186 


SBA 






10111011 


187 


SBB 


i 




10111100 


188 


SBC 






10111101 


189 


SBD 


- 




10111110 


190 


SBE 


> 




10111111 


191 


SBF 


9 





What to Type 
SPACE bar 



Pn 



I 
) 



Alt 



/' 


' 





o 


1 


1 


2 


2 


3 


3 


4 


4 


5 


5 


6 


6 


7 


7 


8 


8 


9 


g 






— 






120 



Appendix H: Conversion Tables 



t 


fao/e W-72. 


Uppercase Characters, High Bit On 






bi 








ASCII 








M 


Binary 


Dec 


Hex 


Char 


Interpretation What to Type 


Pri 


Alt 




11000000 


192 


SCO 


@ 




@ 


@ 


M 


11000001 


193 


SC1 


A 




A 


A 


11000010 


194 


SC2 


B 




B 


B 




11000011 


195 


SC3 


c 




C 


C 




11000100 


196 


SC4 


D 




D 


D 


fa 


11000101 


197 


SC5 


E 




E 


E 


r-a 


11000110 


198 


SC6 


F 




F 


F 




11000111 


199 


SC7 


G 




Q 


G 




11001000 


200 


SC8 


H 




H 


H 


p 


11001001 


201 


SC9 


1 




1 


1 


11001010 


202 


SCA 


J 




J 


J 




11001011 


203 


SCB 


K 




K 


K 




11001100 


204 


sec 


L 




L 


L 


■— a 


11001101 


205 


SCD 


M 




M 


M 


5-^1 


11001110 


206 


SCE 


N 




N 


N 


1 


11001111 


207 


SCF 















11010000 


208 


SDO 


P 




P 


P 


r— a 


11010001 


209 


SD1 







Q 


Q 


h"= 


11010010 


210 


SD2 


R 




R 


R 




11010011 


211 


SD3 


S 




S 


s 




11010100 


212 


SD4 


T 




1 


T 


J — i 


11010101 


213 


SD5 


U 




u 


u 


!~*= 


11010110 


214 


SD6 


V 




v 


v 




11010111 


215 


SD7 


w 




IN 


w 




11011000 


216 


SD8 


>: 




■ 


X 


t— 7 


11011001 


217 


SD9 


Y 




v 


Y 


!~= 


11011010 


218 


SDA 


Z 




Z 


2 




11011011 


219 


SDB 


1 


Opening Bracket 


1 


I 




11011100 


220 


SDC 


v 


Reverse Slant 




\ 


R 


11011101 


221 


SOD 


1 


Closing Bracket 


J 


] 


11011110 


222 


SDE 




Caret 






fc 


11011111 


223 


$DF 




Underline 






















L 
















r 






















H.e 


Eight-Bit Code Conversions 




Il21 



Table H-13. Lowercase Characters. High Bit On 









ASCII 




Binary 


Dec 


Hex 


Char 


Interpretation 


11100000 


224 


SEO 




Open Quote 


11100001 


225 


SE1 


a 




11100010 


226 


SE2 


b 




11100011 


227 


SE3 


c 




11100100 


228 


SE4 


d 




11100101 


229 


SE5 


B 




11100110 


230 


SE6 


1 




11100111 


231 


SE7 


9 




11101000 


232 


SE8 


h 




11101001 


233 


SE9 


i 




11101010 


234 


SEA 


J 




11101011 


235 


SEB 


k 




11101100 


236 


SEC 


1 




11101101 


237 


SED 


m 




11101110 


238 


SEE 


n 




11101111 


239 


SEF 


o 




11110000 


240 


SFO 


P 




11110001 


241 


SF1 


q 




11110010 


242 


SF2 


r 




11110011 


243 


SF3 


a 




11110100 


244 


SF4 


i 




11110101 


245 


SF5 


u 




11110110 


246 


SF6 


V 




11110111 


247 


SF7 


ft 




1 1 1 1 1 000 


248 


SF8 


X 




11111001 


249 


SF9 


y 




11111010 


250 


SFA 


z 




11111011 


251 


SFB 


1 
1 


Opening Brace 


11111100 


252 


SFC 


1 


Vertical Line 


11111101 


253 


SFD 




Closing Brace 


11111110 


254 


$FE 


■ 


Overline (Tilde) 


11111111 


255 


SFF 


DEL 


Delete (Rubout) 



What to Type 



Pri 



a 
b 
c 

d 

a 
f 
g 

h 
i 
I 

i 
m 

n 

P 

q 

r 

s 
t 
u 

V 

w 

X 

y 

z 



Alt 



DELL II" 



DEL 



DEL 



£ 

B^ 

? 
£ 

E* 
£ 

C 









- 



122 



Appendix H: Conversion Tables 






u 



! 

■ ,4 

l: 

E 



Appendix I comprises a listing of the source code for the 
^_J Monitor, enhanced video firmware, and input/output firmware 

contained in the Apple lie. 



E 
\ 

I 

l: 

■ i 

t 



m 

CD 

Q- 



Appendix I: Firmware Listings 1 125 



C100 




2 


*************** 


******* 


It***** 


*** 


ClOO 




3 


* 










ClOO 




4 


* Apple 


//c 








ClOO 




5 


* Video 


Firmware and 






ClOO 




" 


* Monitor ROM E 


ource 






ClOO 




7 


* 










ClOO 




8 


* COPYRIGHT 1977-1983 


8Y 




ClOO 




9 


* APPLE 


COMPUTER, INC. 






ClOO 




to 


* 










ClOO 




11 


* ALL RIGHTS RESERVED 






ClOO 




\2 


* 










ClOO 




13 


* S. WOZNIAK 




1977 




ClOO 




14 


* A. BAUM 




1977 




ClOO 




15 


* JOHN A 


NOV 


1978 




ClOO 




16 


* R. AURICCHIO 


SEP 


1981 




ClOO 




17 


* E. BEERNINK 




1983 




ClOO 




18 


* 










ClOO 




19 


******************************** 


ClOO 




20 


* 










ClOO 




21 


* ZERO 


PAGE EQUATE 






ClOO 




22 


* 










ClOO 


0000 


23 


LOCO 


EQU 


$00 




;vector for autostart from d 


ClOO 


0001 


24 


LOCI 


EOU 


SOI 






ClOO 


0020 


25 


WNDLFT 


EQU 


S20 




;left edge of text window 


ClOO 


0021 


26 


WNDWDTH 


EOU 


S21 




;width of text window 


ClOO 


0022 


27 


WNDTOP 


EQU 


S22 




;top of text window 


ClOO 


0023 


28 


WNOBTM 


EQU 


S23 




;bottora+l of text window 


ClOO 


0024 


29 


CH 


EQU 


S24 




;cursoc horizontal position 


ClOO 


0025 


30 


CV 


EQU 


S25 




;cursor vertical position 


ClOO 


0026 


31 


GBASL 


F.QU 


526 




;lo-res graphics base addr. 


ClOO 


0027 


12 


GBASH 


EOU 


S27 






ClOO 


0028 


33 


BASL 


EQU 


$28 




;text base address 


ClOO 


0029 


34 


BASH 


EQU 


$29 






ClOO 


002A 


35 


BAS2L 


EQU 


$2A 




;temp base for scrolling 


ClOO 


002B 


36 


BAS2H 


EQU 


$2B 






ClOO 


00 2 C 


37 


H2 


EQU 


$2C 




;temp for lo-res graphics 


ClOO 


00 2C 


38 


LMNEM 


EQU 


$2C 




;temp for mnemonic decoding 


ClOO 


002D 


39 


V2 


EQU 


$2D 




;temp for lo-res graphics 


ClOO 


002D 


40 


RMNEM 


EQU 


$2D 




;temp for mnemonic decoding 


ClOO 


002E 


41 


MASK 


EQU 


$2E 




;color mask for lo-res gr. 


ClOO 


002E 


... 


FORMAT 


EQU 


$2E 




;temp for opcode decode 


ClOO 


002F 


43 


LENGTH 


F.QU 


S2F 




;temp for opcode decode 


ClOO 


0030 


.. 


COLOR 


EQU 


$30 




;color for lo-res graphics 


ClOO 


0031 


45 


MODE 


EQU 


$31 




;Moni tor mode 


ClOO 


0032 


.... 


INVFLG 


EQU 


$32 




;normal/inverse( /flash) 


ClOO 


0033 


47 


PROMPT 


EQU 


$33 




;prompt character 


ClOO 


0034 


48 


YSAV 


EQU 


$34 




;posltlon In Monitor command 


ClOO 


0035 


49 


YSAV1 


EQU 


$35 




;temp for Y register 


ClOO 


0036 


50 


CSWL 


EQU 


S36 




; character output hook 


ClOO 


0037 


51 


CSWH 


EQU 


S37 






ClOO 


0038 


52 


KSWL 


EQU 


S38 




;character input hook 


ClOO 


0039 


53 


KSWB 


EQU 


$39 






ClOO 


00 3A 


54 


PCL 


EQU 


S3A 




; temp for program counter 


ClOO 


00 3B 


55 


PCH 


EQU 


$3B 






ClOO 


00 3C 


56 


AIL 


EQU 


$3C 




;Monltor temp 


ClOO 


003D 


57 


A1H 


EQU 


$3D 




;Monitor temp 


ClOO 


00 3E 


58 


A2L 


EQU 


$3E 




;Monltor temp 


ClOO 


003F 


59 


A2H 


EOU 


$3F 




;Monitor temp 



*-L 

S 

- • 

& 



126 



Appendix I: Firmware Listings 



C 



L 



E 



C100 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 

ClOO 



OOAO 
0041 
0042 
0043 
0044 
0045 



F.OU 


$40 


;Monitor temp 


EQU 


$41 


;Monitor temp 


EQU 


$42 


;Monitor temp 


EQU 


$43 


;Monitor temp 


EQU 


$44 


;Monitor temp 


EQU 


$45 


;Monltor temp 



60 A3L 

61 A3H 

62 A4L 

63 A4H 

64 A5L 

65 A5H 

66 * 

67 * Note: In Apple II, //e, both interrupts and BRK destroyed 

68 * location $45. Now only BRK destroys $45 (ACC) and it 

69 * also destroys $44 (MACSTAT). 

70 * 

Machine state after BRK 
Ace after BRK 

X reg after break 
Y reg after break 
P reg after break 
SP after break 
random counter low 
random counter high 



lvalue of //e, lolly ID byte 
;CONTROL-U character 
;what ESC generates 



0044 


71 MACSTAT 


EQU 


$44 


0045 


72 ACC 

73 * 


EQU 


$45 


0046 


74 XREC 


EQU 


$46 


0047 


7 5 YREC 


EQU 


$47 


0048 


76 STATUS 


EQU 


$48 


0049 


77 SPNT 


EQU 


$49 


004E 


78 RNDL 


EQU 


$4E 


O04F 


79 RNDH 

80 * 


EQU 


$4F 




81 * Value « 


quates 




82 * 






0006 


83 C00DF8 


EQU 


$06 


0095 


84 PICK 


EQU 


$95 


009B 


85 ESC 

86 * 


EQU 


$9B 




87 * Characters read by 




88 * IN, terminated by a 




89 * 






0200 


90 IN 

91 * 


EQU 


$0200 




92 * Page 3 


vectors 




93 * 






03F0 


94 BRKV 


EQU 


S03F0 


03F2 


95 SOFTEV 


EQU 


S03F2 


03F4 


96 PWREDUP 


EQU 


S03F4 


03F5 


97 AMPERV 


EQU 


$03F5 


03F8 


98 USRADR 


EQU 


S03F8 


03FB 


99 NMI 


EQU 


$03FB 


03FE 


100 IRQLOC 


EQU 


S03FE 


0400 


101 LINE1 


EQU 


$0400 


07F8 


102 MSLOT 

103 * 


EQU 


S07F8 




104 * HARDWARE EQUATES 




105 * 






COOO 


106 IOADR 


HQU 


scooo 


COOO 


107 KBD 


EQU 


scooo 


COOO 


108 CLR80COL 


EQU 


scooo 


C001 


109 SET80C0L 


EQU 


SCOOl 


C002 


110 RDMAINRAM 


EQU 


$C002 


C003 


111 RDCARDRAM 


EQU 


SC003 


C004 


112 WRMAINRAM 


EQU 


SC004 


C005 


113 WRCARDRAM 


EQU 


$C005 


C008 


114 SETSTDZP 


EQU 


SC008 


C009 


115 SETALTZP 


EQU 


SC009 


COOC 


116 CLR80VID 


EQU 


SCOOC 


COOD 


117 SET80VID 


EQU 


SCOOD 



in 



;input buffer for GETLN 



'.vectors here after break 

;vector for warm start 

;THIS MUST - EOR #$A5 OF SOFTEV+1 

-.APPLESOFT & EXIT VECTOR 

;APPLESOFT USR function vector 

;NMI vector 

;Maskable interrupt vector 

; first line of text screen 

;owner of $C8 space 



;for IN*, PR# vector 
;>127 if keystroke 
;dlsable 80 column store 
;enable 80 column store 
;read from main 48K RAM 
;read from alt. 48K RAM 
;write to main 48K RAM 
;wrlte to alt. 48K RAM 
;use main zero page/stack 
;use alt. zero page/stack 
;disable 80 column hardware 
;enable 80 column hardware 



Appendix I: Firmware Listings 



127 



C100: 


COOE 


118 CLRALTCHAR EQU 


SCOOE 


ClOO: 


COOF 


119 SETALTCHAR EQU 


SCOOF 


ClOO: 


CO 10 


120 KBDSTRB 


EQU 


$C010 


ClOO: 


C011 


121 RDLCBNK2 


EQU 


SCO 11 


ClOO: 


C012 


122 RD1.CRAH 


EQU 


SC012 


ClOO: 


C013 


123 RDRAMRD 


EQU 


SCO 13 


ClOO: 


C014 


124 RDRAMWRT 


EQU 


SCO 14 


ClOO: 


C016 


125 RDALTZP 


EQU 


SCO 1 6 


ClOO: 


C018 


126 RD80C0L 


EQU 


SCO 18 


ClOO: 


C019 


127 RDVBLBAR 


EQU 


SCO 19 


ClOO: 


C01A 


128 RDTEXT 


EQU 


SCO I A 


ClOO: 


C01B 


129 RDHIX 


EQU 


SCO IB 


ClOO: 


C01C 


130 RDPAGE2 


EQU 


SC01C 


ClOO: 


C01D 


131 RDHIRES 


EQU 


SC01D 


ClOO: 


C01E 


132 ALTCHARSRT EQU 


SC01E 


ClOO: 


COIF 


133 RD80V1D 


EQU 


SCO IF 


C1QO: 


CO 20 


134 TAPEOUT 


EQU 


SC020 


ClOO: 


C030 


135 SPKR 


EQU 


SCO 30 


ClOO: 


C050 


136 TXTCLR 


EQU 


SCO 50 


ClOO: 


CO 51 


137 TXTSF.T 


EQU 


SCO 51 


ClOO] 


C052 


138 MIXCLR 


EQU 


SC052 


ClOO: 


C053 


139 MIXSET 


EQU 


SC053 


ClOO: 


C054 


140 TXTPAGE1 


EQU 


SC054 


ClOO: 


C055 


141 TXTPAGE2 


EQU 


SC055 


ClOO: 


CO 56 


142 LORES 


EQU 


SC056 


ClOO: 


C057 


143 HIRES 


EQU 


SC057 


ClOO: 


C058 


144 CLRANO 


EQU 


SC058 


ClOO: 


CO 59 


145 SETANO 


EQU 


SC059 


C 1 no : 


C05A 


146 CLRAN1 


EQU 


$C05A 


ClOO: 


C05B 


147 SETAN1 


EQU 


SC05H 


ClOO: 


C05C 


148 CLRAN2 


EQU 


SC05C 


ClOO: 


C05D 


149 SETAN2 


EQU 


SC05D 


ClOO: 


COSE 


150 CLRAN3 


EQU 


SC05E 


ClOO: 


C05F 


151 SET AN 3 


EQU 


SC05F 


ClOO: 


C060 


152 RD40SW 


EQU 


SC060 


ClOO: 


C061 


153 BUTNO 


EQU 


SC061 


ClOO: 


C062 


154 BUTN1 


EQU 


SC062 


ClOO: 


C064 


155 PADDLO 


EQU 


SC064 


ClOO: 


C070 


156 PTRIG 


EQU 


50071) 


ClOO: 


C081 


157 ROM IN 


EQU 


SC081 


ClOO: 


C083 


158 LCBANK2 


EQU 


SC083 


ClOO: 


COBB 


159 LCBANK1 


EQU 


SC08B 


ClOO: 


CFFF 


160 CLRROM 


EQU 


SCFFF 


ClOO: 


EOOO 


161 BASIC 


EQU 


SEOOO 


ClOO: 


E003 


162 BASIC2 


EQU 


SE003 


ClOO: 




163 * 






ClOO: 


04FB 


164 VMODE 


EQU 


S4F8+3 


ClOO: 




165 * 






ClOO: 




166 * BASIC 


VMODE 


BITS 


ClOO: 




167 * 






ClOO: 
ClOO: 












. . - Pascal active 


ClOO: 










ClOO: 










ClOO: 




172 * ..0... 


.. - P 


rlnt control 


ClOO: 




173 * ..1... 


. . - Don't print c 


ClOO: 




174 * ...0.. 


. . - 




ClOO: 




175 * ...1.. 







;norraal LC, flashing UC 

jnormal inverse, LC; no flash 

;turn off key pressed flag 

;>127 if LC bank 2 is in 

;>127 if LC RAM read enabled 

;>127 if reading main 48K 

;>127 Lf writing main 48K 

;>1 27 if Alt ZP and LC switched In 

;>127 if 80 column store 

; >1 27 if not VBL 

; > 1 2 7 tf text (not graphics) 

;>127 if mixed mode on 

;>127 if TXTPAGE2 switched in 

;>127 if HIRES is on 

;>1 27 if alternate char set in use 

;>127 if 80 column hardware in 

;what Is this7? 

;cllcks the speaker 

;switch in graphics (not text ) 

;switch in text (not graphics) 

;clear mixed-mode 

;set mixed-mode (4 lines text) 

;switch in text page 1 

;switch in text page 2 

; low-resolution graphics 

;high-resolutlon graphics 



— 



— 



- 



;>127 if 40/80 switch in 40 pos 

;open apple key 

;closed apple key 

;read paddle 

•.trigger the paddles 

-.switch in SDOOO-SFFFF ROM 

•.switch in LC bank 2 

;switch in LC bank 1 

; switch out $C8 ROMs 

; BASIC entry point 

;BAS1C warm entry point 

OPERATING MODE 



characters 
t rl chars 



128 



Appendix I; Firmware Listings 



L 


















*— 4 
















8 


C100 




176 


* 0.. 


- Print control characters 




I 


CI 00 




177 


* 


...!.. 


- Don' c print Ctrl 


chars. 






C100 




178 


* 


0. 


- 






■ — 


C100 




179 


* 


....1. 


- 






1 


C100 




180 


* 





- 






L 


C100 




181 


* 


1 


- 






■ ■ 

■ — 


C100 




182 


* 


- Print mouse characters 




C100 




183 


* 





- Don't print mouse characters 






C100 




184 


* 








L 


C100 


0040 


185 


M.40 


EOU $40 






■ ,M 


CI 00 


0020 


186 


H.CTL2 


EQU $20 


;Don't print controls 




1 — 


C100 


0008 


187 


M.CTL 


EOU $08 


;Don't print controls 






C100 


0001 


188 


M. MOUSE 


EOU $01 


;Don't print mouse chars 




L^ 


CI 00 




189 


* 








i— n 


C100 




190 


* Pascal Mode Bits 






1 — 


C100 




191 


* 








I 


CIOO 




192 


* 1 


- BASIC active 






i_ 


C100 
C100 




193 

194 


* 

* .0 


- Pascal active 






■ 


C100 




195 


* 


1 








I 


C100 




196 


* 


.0 


- 






L- 


C100 




197 


* 


.1 


- 






5-r£ 


C100 




198 


* 


..0... 


- Cursor always on 






|^ 


C100 




199 


* 


..1. .. 


- Cursor always off 




[ 


C100 




200 


* 


...0.. 


- COTOXY n/a 






* 


CIOO 




201 


* 


...1.. 


- GOTOXY in progress 




■— k 


CIOO 




202 


* 


....0. 


- Normal Video 






1 - 


CIOO 




203 


* 


1. 


- Inverse Video 






1 


CIOO 




204 


ft 





- 






^n 


CIOO 




205 


* 


1 


- 






5~^ 


CIOO 




206 


* 


- Print mouse chars 




1 


CIOO 




207 


* 





- Don't print mouse chars 




I! 


CIOO 




208 


* 








^^^^^^^ 


CIOO 


0080 


209 


M.PASCAL 


EQU $80 


; Pascal active 




■ — 


CIOO 


0010 


210 


M. CURSOR 


EOU $10 


;Don't print cursor 




1 


CIOO 


0008 


211 


M.COXY 


EOU $08 


; GOTOXY IN PROGRESS 




L 


CIOO 


0004 


212 


M.VMODE 


EOU $04 






h* 


CIOO 




213 


ft 








CIOO 


0478 


214 


ROMSTATE 


EQU $478 


;temp store of ROM state 




I 


CIOO 


04F8 


215 


TEMPI 


EOU $4F8 


;used by CTLCHAR 




I 


CIOO 


0578 


216 


TEMPA 


EQU $578 


;used by scroll 




■ h 


CIOO 


05F8 


217 


TEMPY 


EQU $5F8 


;used by scroll 




■ — 


CIOO 




218 


* 








I 


CIOO 


047B 


219 


OLDCH 


EQU $4 78+3 


;last value of CH 




I 


CIOO 


057B 


220 


OURCH 


EQU $578+3 


;80-C0L CH 




■ * 


CIOO 


05FB 


221 


OURCV 


EQU S5F8+3 


; CURSOR VERTICAL 




■ - 


CIOO 


067B 


222 


VFACTV 


EQU $678+3 


;Bit7-video firmware inactive 




1 


CIOO 


06FB 


223 


XCOORD 


EQU S6F8+3 


;X-COORD (GOTOXY) 




■ 


CIOO 


077B 


224 


NXTCUR 


EQU $778+3 


;next cursor to display 




P 


CIOO 


07FB 


225 


CURSOR 


EQU S7F8+3 


;the current cursor char 




CIOO 




17 




INCLUDE SERIAL 


;Equates for aerial code 




















1 - 
















h 
















L 










\ppendix 1: Firmware 






r 




i 


i Listings 1 129 





C100: 

ClOO 

CI 00: 

CIOO 

ClOO 

CIOO: 

ClOO 

CIOO: 

CIOO 

CIOO 

CIOO 

CIOO 

CIOO 

CIOO 

CIOO: 

CIOO 

CIOO; 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO 

CIOO 

CIOO: 

CIOO; 

CIOO 

CIOO: 

CIOO 

CIOO 

ctoo 

CIOO 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO; 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO; 

CIOO: 

CIOO: 

CIOO 

CIOO: 

CIOO 

CIOO; 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO: 

CIOO; 



CIOO 
C200 

OOBF 
OODF 

0091 
03B8 
0438 
04B8 
0538 
05F9 
05FA 
0679 
067A 
0638 
06B8 
0738 
047F 
04FF 
057F 

05 FF 
067F 
06FF 
0800 

06 F8 
BFF8 



**************************************** 

* 

* Apple Lolly communications driver 



By 

Rich Williams 

August 1983 

November 5 — j.r.huston 



Default command char is ctrl-A ("A) 



3 
4 
5 
6 
7 
8 

10 

II 

12 
13 
14 
15 
16 
17 
18 
L9 
20 
21 
22 

23 

24 

2 r > 

2 b 
27 

29 
29 

30 
31 
32 

33 
34 
35 
36 

37 emdeur 

38 termcur 
39 

40 xon 

41 sermode 

42 astat 

43 pwdth 

44 extint 

45 excint2 

46 typhed 

47 oldcur 

48 oldcur'2 

49 eschar 

Elagfl 

col 
number 



* 
* 
* 
**************************************** 

* 

* Command codes 

* 
* 
* 

A 
* 

* 

A 

A 
* 
* 
* 

* 
* 
* 

» 
* 
**************************************** 






AnnB: 

AnnD: 

AT: 

AK: 

AL: 

AnnN: 

AnnP: 

AQ 

AH 

AS 

AT 

AZ: 

Ax: 



Set baud rate to nn 

Set data format bits to nn 

F.nable video echo 

Disable CRLF 

Enable CRLF 

Disable video echo & set printer width 

Set parity bits to nn 

Quit terminal mode 

Reset the ACIA, IN#0 PR*0 

Send a 233 ms break character 

Enter terminal mode 

Zap control commands 

Set command char to ~x 



*AnnCR:Set printer width (CR - carriage return) 



serslot 

corns lot 



50 
51 

52 



53 aclabuf 



54 
5 5 
5fi 
5 7 
5B 
59 
50 



twser 
twkey 
trser 
trkey 

thbuf 

temp 

sdata 



equ 
equ 
MSB 
equ 
equ 
MSB 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
.-.pi 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
equ 
equ 



SC100 
$C200 
ON 

'?' 

• i 

OFF 

S91 

S3B8 

$438 

S4B8 

S538 

S5F9 

S5FA 

$679 

S67A 

$638 

S6B8 

$738 

$47F 

$4FF 

$57F 

S5FF 

$67F 

S6FF 

S800 

$6F8 

$BFFB 



;Cursor while on command mode 
;Cursor while in terminal mode 

;X0N character 

;D7=1 if in ctnd; D6-1 if term 479 & 47A 

;Acla status from int 4F9 & 4FA 

;Printer width 579 & 57A 

;extint & typhed enable 5P9 & 5FA 



;Saves cursor while in command 

; Saves cursor while in terminal mode 

{Current escape character 6F9 & 6FA 

;D7 = Video echo D6 - CRLF 779 & 77A 

;Current printer column 7F9 & 7FA 

;Nuraber accumulated in command 

;Owner of serial buffer 

;Storage pointer for serial buffer 

; Storage pointer for type ahead buffer 

;Retrleve pointer for serial buffer 

;Retrieve buffer for type ahead buffer 

; Buffer in alt ram space 

;Temp storage 

;+$N0+S90 is output port 



— 



130' 



Appendix I: Firmware Listings 



1 — 


C100 


BFF9 


61 sstat 


equ 


S8FF9 


;ACIA status register 




ClOO 


BFFA 


62 Bcomd 


equ 


SBFFA 


;ACIA command register 


L.^ 


ClOO 


BFFB 


63 scntl 


equ 


SBFFB 


;ACIA control register 


u. 


ClOO 


FF58 


64 iorts 


equ 


3FF58 


;RTS opcode 


- 


ClOO 




18 


INCLUDE SER 


;Printer port @ SC100 



LZ 



E 

E 



Appendix I: Firmware Listings 



131 



C100: 






3 


*org sere 


lot 






C100:2C 


58 


FF 


4 




bit 


lorts 


;Set V to indicate initial entry 


C103:70 


OC 


cm 


5 




bvs 


entrl 


; Always taken 


C105:38 






6 




sec 




;Input entry point 


C106:90 






7 




dfb 


S90 


; BCC opcode 


C107:18 






a 




clc 






C108:B8 






9 




civ 




;V - since not initial entry 


C109:50 


06 


cm 


10 




bvc 


entrl 


; Always taken 


C10B:01 






12 




dfb 


$01 


; pascal signiture byte 


C10C:31 






n 




dfb 


$31 


;device signiture 


C10D:E4 






14 




dfb 


>plinlt 




ClOE:EE 






is 




dfb 


>plread 




C10F:F6 






16 




dfb 


>plwrlte 




CllOrFB 






17 




dfb 


>plstatus 




CI 1 1 :DA 






19 


entrl 


phx 




;Save the reg 


C112:A2 


CI 




20 




ldx 


*<serslot 


;X - Cn 


C114:4C 


33 


C2 


21 




jmp 


setup 


;Set raslot, etc 


C117:90 


05 


cue 


22 


serport 


bec 


sertsout 


;0nly output allowed 


CU9:20 


4D 


CE 


23 




jsr 


zzqult 


-.Reset the hooks 


C11C:80 


>:A 


C188 


24 




bra 


done 




C11E:0A 






25 


serlsout 


asl 


A 


;A - flags 


C11F:7A 






26 




ply 




;Get char 


C120:5A 






27 




phy 






C121:BD 


88 


04 


28 




Ida 


pwdth.x 


; Formatting enabled? 


C124:F0 




C168 


29 




beq 


prnow 




Ci26:A5 


24 




30 




Ida 


ch 


;Get current horiz position 


C128:BO 


1C 


C146 


31 




bes 


servLd 


;Branch if video echo 


C12A:DD 


B8 


04 


32 




emp 


pwdth.x 


;If CH >- PWIDTH, then CH - COL 


C12D:90 


03 


CI 32 


33 




bec 


chok 




C12F:BD 


38 


07 


34 




Ida 


col.x 




C132:DD 


38 


07 


35 


chok 


emp 


col ,x 


;Must be > col for valid tab 


C135:B0 


OB 


C142 


36 




bes 


fixch 


; Branch if ok 


C137:C9 


11 




37 




emp 


f$ll 


;8 or 16? 


C139:BO 


11 


cue 


38 




bes 


prnt 


;If > forget it 


C13B:09 


FU 




39 




ora 


P$F0 


;Find next comma cheaply 


C13D:3D 


38 


07 


40 




and 


col ,x 


; Don't blame me it's Dick's trie 


C140:65 


24 




41 




adc 


ch 




CU2:85 


24 






fixch 


sta 


ch 


;Save the new position 


C144:80 


06 


C14C 


43 




bra 


prnt 




C146:C5 


21 




44 


servid 


crap 


wndwdth 


;If ch>=« wndwdth go back to stai 


C148:90 


02 


C14C 


45 




bit 


prnt 




C14A:64 


24 




.'.-, 




stz 


ch 


;Go back to left edge 



C14C: 
C14C:7A 
C14D:5A 
C14F.:BD 38 07 
C151:DD B8 04 
C154:B0 08 C15E 
C156:C5 24 
C158-.B0 0E C168 
C15A:A9 40 
C15C:80 02 C160 
C15E:A9 1A 



48 * We have a char to print 



49 prnt 


Ply 




50 


phy 




51 


Ida 


col ,x 


52 


emp 


pwdth.x 


c -3 


bge 


toofar 


54 


emp 


ch 


55 


bge 


prnow 


n 


Ida 


0S4O 


57 


bra 


tab 


58 toofar 


Ida 


(CS1A 



- 
- 

-I 

: 

: 



;Have we exceeded width? 

;Are we tabbing? 
; Space * 2 
;CR * 2 



132 



Appendix I: Firmware Listings 























■— * 






















C160:C0 


BO 




59 


tab 


cpy 


ffS80 


;C - High bit 






C162:6A 






60 




ror 


A 


;Shift it into char 




, M 


C163:20 


9D 


CI 


61 




jar 


serout 3 


;0ut It goes 




1 


C166:80 
C168:98 


E4 


cue 


62 

63 


prnow 


bra 
tya 


prnt 








C169:20 


8C 


CI 


64 




jsr 


serout 


-.Print the actual char 




lu 


C16C:BD 


B8 


04 


65 




Ida 


pwdth.x 


;Forraatting enabled 




■ -— 


C16F:F0 


17 


C188 


66 




beq 


done 








C171:3C 


B8 


06 


67 




bit 


flags, x 


;In video echo? 






C174:30 


12 


C188 


68 




bmi 


done 






& 


C176:BD 


38 


07 


69 




Ida 


col.x 


;Check If within 8 chars of right edge 




C179:FD 


B8 


04 


70 




sbc 


pwd t h , x 


;So BASIC can format output 






C17C:C9 


FB 




71 




emp 


*SF8 






1^^ 


C17E:90 


04 


C184 


72 




bec 


setch 


;If not within 8, we're done 




■ — -4* 


C180:18 






73 




clc 








C181:65 


21 




74 




adc 


wndwdth 








C183:AC 






75 




dfb 


SAC 


;IXiramy LDY to skip next two bytes 




p 


C184:A9 


00 




76 


setch 


Ida 


#0 


;Keep cursor at If video off 




C186:85 


24 




77 




sta 


ch 






C188:68 






78 


done 


pla 




;Restore regs 






C189:7A 






■"■' 




Ply 








P 


C18A:FA 






80 




Pi* 








C18B:60 






HI 


socmii 


rts 








1^^^ 




















L— U 


CISC: 




C18C 


83 


serout 


equ 


* 


;Serial output 




1 - 


C18C:20 


EB 


C9 


84 




jsr 


command 


;Check if command 






C18F:90 


FA 


C18B 


85 




bec 


socmd 


;All done if It is 




■— 


C191: 




C191 


86 


serout2 


equ 


* 






M jj 


C191:3C 


B8 


06 


87 




bit 


flags, x 


;N-1 iff video on 






C194:10 


07 


C19D 


88 




bpl 


serout3 








C196:C9 


91 




B9 




crap 


#xon 


;Don't echo *Q 




b 


C198:F0 


03 


C19D 


90 




beq 


serout3 






C19A:20 


FO 


FD 


91 




Isr 


cout 1 


;F,cho it 






C19D: 




C19D 


92 


serout3 


equ 


* 








C19D:BC 


85 


08 


93 




ldy 


devno.x 


;Y points to ACIA 




■"^ 


ClA0:48 






94 




pha 




;Save the char 




C1A1:2C 


58 


FF 


95 




bit 


iorts 


;Control char? 






C1A4:F0 


03 


CIA9 


96 




beq 


sordy 


; Don't inc column If so 






C1A6:FE 


38 


07 


97 




Inc 


col.x 






■ — 


C1A9:08 






98 


sordy 


php 




;can't have real interrupts for a while 




C1AA:78 






99 




sei 










C1AB:89 


F9 


BF 


100 




Ida 


sstat ,y 


;Check XHIT empty & DCD 




l 


C1AE:10 


11 


C1C1 


101 




bpl 


sordy2 


; branch if not clearing an interrupt 






C1B0:48 






102 




pha 




;save original status 




■ - 


C1B1:5A 






103 




phy 










C1B2:2C 


U 


GO 


104 




bit 


rdramwrt 


;Save state of aux ram 




Is- 


C1B5:08 






105 




php 








p 


CI 86: 20 


1C 


C9 


106 




.1ar 


altst2 






C1B9:28 






107 




pip 








1 


C1BA:10 


03 


C1BF 


108 




bpl 


somaln 


; Branch if was main 




g^ 


C1BC:8D 


05 


CO 


109 




sta 


wrcardram 


;Was alt ram 




M 


CtBF:7A 






110 


soma In 


ply 








1 


CI CO: 68 
C1C1:2B 






111 
112 


sordy2 


pla 
pip 








■ n 


C1C2:29 


30 




113 




and 


#$30 






E 


C1C4:C9 


10 




114 




emp 


#310 






r 












Appendix I: Firmware Listings 1 133 





C1C6: 


:DO 


Kl 


i 


C1A9 


115 




bne 


sordy 








C1C8: 
C1C9: 


;48 








116 

117 




pi. 

pha 




;Get char 


to XMIT 


i— 


C1CA: 


:99 


F8 


BF 




118 




sta 


sdata.y 


;Out it goes 


C1CD: 


i3C 


BB 


06 




119 




bit 


flags, x 


;V-1 if LF 


after CR 




C1D0: 


|49 


on 






120 




eor 


ffSOD 


; check for 


CR. 





C1D2: 


:m A 








121 




asl 


A 


;preserve bit 7 




C1D3; 


: DO 


OD 


i 


21E2 


122 




bne 


sodone 


; branch if 


not CR. 


C1D5: 


:50 


06 


\ 


:idd 


123 




bvc 


clrcol 


;branch if 


no LF after CR 


1 


C1D7: 


:A9 


U 






124 




Ida 


f$l4 


;Get LF*2 




_-J 


C1D9: 


:6A 








125 




ror 


A 


;no shift 


Ln high bit 


i—i 


CIDA: 


:20 


9D 


CI 




126 




jar 


serout3 


;Output che LF but don't echo it 


"" 1 


C1DD: 


:64 


24 






127 


clrcol 


stz 


ch 


;0 position & column 




C1DF: 


;9E 


38 


07 




128 




BtZ 


col.x 






_J 


C1E2: 


;6S 








129 


sodone 


pla 




;Get the char back 


—j 


CIE3: 


: 60 








130 




rts 








~A 



1 

I— 



134 



Appendix I: Firmware Listings 



j 

j 



L 

t: 
t: 

■ 4 

l: 



E 



C1E4: 132 * Pascal support stuff 



C1E4:48 






134 


plinit 


pha 




C1E5:20 


ca 


C2 


135 




jsr 


default 


C1E8:9E 


B8 


06 


136 




stz 


flags, x 


C1EB:68 






137 




pla 




CI EC: 80 


05 


C1F3 


138 




bra 


plread2 


C1EE:20 


C5 


C8 


140 


pi read 


jar 


XRDSF.R 


CIF1:90 


FB 


C1EE 


141 




bcc 


pi read 


CIF3:A2 


cm 




142 


plread2 


ldx 


#0 


C1F5:60 






143 




rts 




C1F6:20 


8C 


CI 


145 


plwrlte 


jsr 


serout 


C1F9:80 


Ffl 


C1F3 


146 




bra 


plread2 


C1FB:80 


1A 


C217 


147 


plstatus 


bra 


p2status 



;set defaults, enable acta 



11 di 



;read data from serial port (or buffer) 
; Branch if data not ready 



;Go output character 



C1FD: 0003 149 ds comslot-*, S00 

C200: 19 INCLUDE C0MM ;Coramunications port @ SC200 



Appendix I: Firmware Listings 1 135 



C200:2C 


58 


FF 


3 


bit 


iorta 


C203:70 


2B 


C230 


4 


bvs 


entr 


C205:38 






5 sin 


sec 




C206:90 






6 


dfb 


$90 


C207:18 






7 HOUt 


clc 




C208:B8 






8 


civ 




C209:50 


25 


C230 


9 


bvc 


entr 


C208:01 






11 


dfb 


$01 


C20C:31 






12 


dfb 


$31 


C20DMI 






13 


dfb 


>p21nit 


C20E:13 






14 


dfb 


>p2read 


C20F:15 






15 


dfb 


>p2write 


C210:17 






16 


dfb 


>p2status 



;Set V to Indicate Initial entry 

; Input entry point 
;BCC opcode to skip next byte 

;0utput entry point 

;Mark not initial entry 
;Branch around pascal entry stuff 

;pascal stgniture byte 

;devlce signiture 



G211: 

C2I1:80 Dl C1E4 
C213:80 D9 C1EE 
C215:80 DF C1F6 

C217 



C22E 



18 * Pascal support stuff 



C217: 


< 


C217:A2 


40 


C219:4A 




C21A:D0 


12 1 


C21C:AA 




C21D:A9 


08 


C21F:B0 


01 i 


C221:0A 




C222:09 


20 


C224:39 


89 CO 


C227:FO 


05 ' 


C229:49 


20 


C22B:38 




C22C:DO 


01 i 


C22E:18 




C22F:60 




C230:DA 




C231:A2 


C2 


C233: 


i 


C233:5A 




C234:48 




C235:8E 


F8 07 


C238:50 


22 


C23A:A5 


36 


C23C:45 


38 


C23E:F0 


06 


C240:A5 


37 


C242:C5 


39 


C244:FO 


03 


C246:20 


C8 C2 


C249:8A 




C24A:45 


39 


C24C:05 


38 


C24E:D0 


07 


C250:A9 


05 


C252:85 


38 



C222 



C22E 



C22F 



C233 



C25C 



C246 



C249 



C257 



20 P 2init 

21 p2read 

22 p2wrlte 

24 p2status 

25 

26 

27 

28 

29 

30 

31 

32 pstat2 

33 

34 

35 

16 

37 

38 notrdy 

39 isrdy 

41 entr 

42 

43 setup 

44 

46 
47 
48 
49 

50 
51 
52 
53 

54 sudodef 

55 sunodef 
56 

57 
58 
59 
60 



bra 
bra 
bra 

equ 
ldx 
lsr 
bne 
tax 
Ida 
bcs 
asl 
ora 
and 
beq 
eor 
sec 
bne 
clc 
rts 

phx 
ldx 
equ 
phy 
pha 
stx 
bvc 
Ida 
eor 
beq 
Ida 
cmp 
beq 
jsr 
txa 
eor 
ora 
bne 
Ida 
sta 



pllnit 
pi read 
plwrl te 

* 

#$40 
a 
notrdy 

#8 

pstat2 

a 

#$20 

sstat+$90,y 

notrdy 

#$20 

tsrdy 



#<coraslot 



roslot 

sudone 

cswl 

kswl 

sudodef 

cswh 

kswh 

sunodef 

default 

kswh 

kswl 

suout 

#>sin 

kswl 



;anticipate bad status request 
; shift request to carry 

;clear x for no error return code 
;anticpate input ready request 
; branch if good guess. 

; Include DCD In test 

;branch if not ready for 1/0 

;assume port is ready 

;branch if good assumption 

; indicate acia not ready for l/O 



;X - <CN00 



;Flrst call? 

;If both hooks CN00 setup defaults 



;If both hooks CN then don't do def 
;since it has already been done 

;Set up defaults 

; Input call? 

-.Must be CnOO 

;Fix the input hook 



- 



~ 



1361 



Appendix I: Firmware Listings 






l; 
\z 

I 

l: 
l: 

E 

L 

l: 

■ H 

E 



C254:38 






61 




sec 




;C - 1 for input call 


C255:80 


M 


C25C 


62 




bra 


sudone 




C257:A9 


07 




63 


suout 


Ida 


#>sout 


;Flx output hook 


C259:85 


K 




64 




sea 


cswl 


;Note C might not be 


C25B:18 






65 




clc 




;C"0 for output 


C25C:BD 


B8 


06 


66 


sudone 


Ida 


f lags.x 


;Check if serial or comra port 


C25F:89 


01 




67 




bit 


fl 


;Leave flags in a for serport 


C261:D0 


03 


C266 


68 




bne 


commport 




C263:4C 


17 


CI 


69 


coraout 


jtnp 


serport 




C266:90 


ra 


C263 


70 


commport 


bec 


comout 


;Output? 


C268:68 






71 




pla 




;Cet the char 


C269:80 


28 


C293 


72 




bra 


terml 


; Input 


C26B:3C 


B8 


03 


73 


noesc 


bit 


sermode ,x 


;In terminal mode? 


C26E:50 


1C 


C28C 


74 




bvc 


exitl 


;lf not, return key 


C270:20 


91 


CI 


75 




jar 


serout2 


;Out it goes 


C273:80 


IE 


C293 


76 




bra 


terml 




C275: 




C275 


77 


testkbd 


equ 


* 




C275:68 






78 




pla 




;Get current char 


C276:20 


70 


CC 


79 




jsr 


update 


;Update cursor & check keyboard 


C279:10 


IB 


C296 


80 




bpl 


serin 


; N"0 if no new key 


C27B:20 


EB 


C9 


81 




jsr 


command 


;Test for command 


C27E:B0 


EB 


C26B 


82 




bes 


noesc 


;Branch if not 


C280:29 


5F 




83 




and 


#$5f 


;upshift for following tests 


C282:C9 


31 




84 




emp 


tf'Q' 


;0uit? 


C284:F0 


M 


C28A 


85 




beq 


exltX 




C286:C9 


52 




86 




emp 


ff'R* 


;Reset? 


C288:D0 


,(U 


C293 


87 




bne 


terml 


;Go check serial 


C28A:A9 


-.» 




88 


exitX 


Ida 


#$98 


; return a CTRL-X 


C28C:7A 






89 


exicl 


ply 






C28D:FA 






90 




plx 






C28E:60 






91 




rtB 






C28F:18 






92 


gocemote 


clc 




;Into remote mode 


C290:20 


CD 


CA 


93 


goterm 


jsr 


setterm 


;Into terminal mode 


C293: 




C293 


94 


terml 


equ 


* 




C293:20 


4C 


CC 


95 




jsr 


showcur 


;Get current char on screen 


C296:48 






96 


serin 


pha 






C297:20 


C5 


C8 


97 




Jsr 


XRDSER 


; is it ready? 


C29A:90 


:>9 


C275 


98 




bec 


testkbd 


;Tf not, try the keyboard 


C29C:A8 






99 




tay 




;Save new input in y for now 


C29D:68 






100 




pla 






C29E:5A 






101 




phy 




;Save new char on stack 


C29F:20 


B8 


C5 


102 




jsr 


storch 


;Fix the screen 


C2A2:68 






103 




pla 




;Get the new data 


C2A3:BC 


38 


06 


104 




ldy 


eschar ,x 


;If 0, don't modify char 


C2A6:F0 


16 


C2BE 


105 




beq 


slnomod 




C2A8:09 


BO 




106 




ora 


#$80 


;Apple loves the high bit 


C2AA:C9 


8 A 




107 




emp 


#$BA 


;Ignore line feed 


C2AC : FO 


E5 


C293 


106 




beq 


terml 




C2AE:C9 


91 




109 




emp 


#xon 




C2BO:FO 


El 


C293 


110 




beq 


terml 


; Ignore ~Q 


C2B2:C9 


■■T 




111 




emp 


#$FF 


; Ignore FFs 


C2B4:F0 


DD 


C293 


112 




beq 


terml 




C2B6:C9 


92 




113 




emp 


#$92 


;"R for remote? 


C2B8:FO 


D5 


C28F 


114 




beq 


goremote 




C2BA:C9 


94 




115 




crap 


#$94 


;*T for terminal mode? 


C2BC:FO 


D2 


C290 


116 




beq 


gotern 




C2BE:3C 


B8 


03 


117 


slnomod 


bit 


sermode, x 


; Tn terminal mode? 


C2C1:50 


G9 


C28C 


118 




bvc 


exttl 


;Return to user if not A a char 



Appendix I: Firmware Listings 



137 



C2C3:20 

C2C6:80 

C2C8: 

C2C8:20 

C2CB-.BC 

C2CE:20 

C2D1:48 

C2D2:88 

C2D3:30 

C2D5:C0 

C2D7:DO 

C2D9:20 

C2DC:68 

C2DD-.BC 

C2E0:99 

C2E3:68 

C2E4:99 

C2E7:68 

C2E8:9D 

C2EB:29 

C2ED:D0 

C2EF:A9 

C2F1:9D 

C2F4:68 

C2F5:9D 

C2F8:9E 

C2F8:60 

C2FC:03 

C2FE: 

C300: 



ED FD 
CB C293 
C2C8 
A2 C8 

3B C2 
7C C3 



04 C2D9 

03 

F5 C2CE 

A2 C8 

85 C8 
FB 8F 

FA BF 

B8 06 

01 

02 C2F1 

09 

38 06 



B8 04 
B8 03 

D7 



0002 



119 
120 

121 default 
122 
123 

124 defloop 
125 
126 
127 
128 
129 

130 defff 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 

141 defcom 
142 
143 
144 
145 

146 defidx 
147 
20 



jsr 

bra 

equ 

jsr 

Idy 

jsr 

pha 

dey 

bmi 

cpy 

bne 

jsr 

pla 

ldy 

sta 

pla 

sta 

pla 

sta 

and 

bne 

Ida 

sta 

pla 

sta 

stz 

rts 

dfb 

ds 

INCLUDE C3SPACE 



cout 

corral 

* 

moveirq 

defldx-SCl.x 

getalt 



defff 

#3 

defloop 

moveirq 

devno,x 
acntl.y 

scorad ,y 

flags, x 
t\ 

defcom 

#9 
eschar, x 

pwdth.x 
sermode,x 

3.7 

$C300-*,S0O 



;0nto the screen with It 

;Set up the defaults 

;make sure lrq vectors ok 

; Index into alt screen. Table in command 

;Get default from alt screen 



;Done if minus 

;0r if 2 

;Jam irq vector into LC 
;Command, control & flags on stack 

;Set command reg 



; And the flags 

;A a S01 ("A) if comra mode 

;*I for serial port 

;Get printer width 



- 

i— i 

"J 

J 



;80 column card 9 SC300 



— 



- 



"- 
^ 



138 



Appendix I: Firmware Listings 



a 

— i 

j 



L 

l: 

■ u 

l: 

■ . 

l: 

L 

■ U 

I 
L 

■ 

L; 

L 



C300: 




2 **************************************** 


C300: 




3 * 








C300: 




4 * THIS IS THE 


SC3XX ROM SPACE: 


C300: 




5 * 








C300: 




6 **************************************** 


C300:48 




7 C3EKTRY 


PHA 




; save regs 


C30l:DA 




a 


PHX 






C302:5A 




9 


PHY 






C303:80 12 


C317 


10 


BRA 


BASICINIT 


;and init video firmware 


C305:38 




11 C3KEYIN 


SEC 




;Pascal 1. 1 ID byte 


C306:90 




12 


DFB 


S90 


;BCC OPCODE (NEVER TAKEN) 


C307:18 




13 C3C0UT1 


CLC 




;Pascal 1.1 ID byte 


C308:80 IA 


C324 


14 


BRA 


BASICENT 


;">go print/read char 


C30A:EA 




15 


NOP 






C30B: 




16 * 








C30B: 




17 * PASCAL 


1.1 FIRMWARE PROTOCOL TABLE: 


C30B: 




18 * 








C30B:01 




L9 


DFB 


SOI 


;GENERIC SIGNATURE BYTE 


C30C:88 




20 


DFB 


S88 


; DEVICE SIGNATURE BYTE 


C30D: 




21 * 








C30D:2C 




22 


DFB 


XJPINIT 


; PASCAL INIT 


C30E:2F 




23 


DFB 


> J PRE AD 


; PASCAL READ 


C30F:32 




24 


DFB 


XJPWRITE 


; PASCAL WRITE 


C310:35 




25 


DFB 


>JPSTAT 


; PASCAL STATUS 


C311: 




26 **************************************** 


C311: 




27 * 








C311: 




28 * 128K SUPPORT 


ROUTINE ENTRIES: 


C311: 




29 * 








C3ll:4C 86 


CF 


30 


JMP 


MOVEAUX 


;MEMORY MOVE ACROSS BANKS 


C3H:4C CD 


CF 


31 


JMP 


XFF.R 


: TRANSFER ACROSS BANKS 


C317: 




32 **************************************** 


C317: 




33 * 








C317: 




34 **************************************** 


C317: 




35 * BASIC I 


/O ENTRY POINT: 




C317: 




36 **************************************** 


C317: 




37 * 








C317:20 20 


CE 


38 BASICINIT JSR 


HOOKUP 


; COPYROM if needed, sethook 


C31A:20 BE 


CD 


39 


JSR 


SET80 


;secup 80 columns 


C31D:20 58 


FC 


60 


JSR 


HOME 


;clear screen 


C320:7A 




41 


PLY 






C321:FA 




■*:: 


PLX 




; restore X 


C322:68 






PLA 




; restore char 


C323: 18 




44 


CLC 




•.output a character 


C324: 




45 * 








C324:B0 03 


C329 


46 BASICENT 


BCS 


BINPUT 


;->carry me to input 


C326:4C F6 


FD 


47 BPRINT 


JHP 


COUTZ 


-.print a character 


C329:4C IB 


FD 


48 B1NPUT 


JMP 


KEY IN 


;get a keystroke 


C32C: 




49 * 








C32C:4C 41 


CF 


50 JPINIT 


JMP 


PIN1T 


;pascal init 


C32F:4C 35 


CF 


51 JPRF.AD 


JMP 


PASREAD 


; pascal read 


C332:4C C2 


CB 


52 JPWR1TE 


JMP 


PWRITE 


;pascal write 


C335:4C Bl 


r.F. 


53 JPSTAT 


JMP 


PSTATUS 


;pascal status call 


C338: 




54 * 








C338: 




55 * COPYROM 


is c* 


lied when Che 


video firmware Is 


C338: 




56 * Initialized. 


If the language card Is switched 


C338: 




57 * In for 


readin 


g, It copies 


the F8 ROM to the 


C338: 




58 * language card 


and restores 


the state of the 


C338: 




59 * laneuae 


e card 







Appendix I: Firmware Listings 



139 



C338: 






60 


* 










C338:A9 


06 




61 


COPY ROM 


LDA 


i*GOODF8 


;get the ID byte 


C33A: 






62 


A 










C33A: 






63 


* 


Compare 


ID by 


tes to whatever Is readable. If it 


C33A: 






64 


* 


matches 


, all 


is ok. If not 


., need to copy. 


C33A: 






65 


* 










C33A:CD 


83 


KB 


66 






CMP 


F8 VERS ION 


;does it match? 


C33D:FO 


3C 


C37B 


67 






BEQ 


ROMOK 




C33F:20 


60 


C3 


68 






JSR 


SETROM 


;read ROM, write RAM, save state 


C342:A9 


F8 




69 






LDA 


0SF8 


;from F800-FFFF 


C344:85 


37 




70 






STA 


CSWH 




C346:64 


1M 




M 






STZ 


CSWL 




C348:B2 


36 




72 


C0PYR0M2 


LDA 


(CSWL) 


;get a byte 


C34A:92 


36 




73 






STA 


(CSWL) 


; and save a byte 


C34C:E6 


36 




74 






INC 


CSWL 




C34E:D0 


F8 


C348 


7 ; ) 






BNE 


COPYROM2 




C350:E6 


37 




7-. 






INC 


CSWH 




C352:DO 


FA 


C348 


77 






BNE 


C0PYR0M2 


;fall Into RESETLC 


C354: 






78 


* 










C354: 






79 


* 


RESETLC 


1 resets the language 


card to the state 


C354: 






80 


* 


deterral 


ned by 


SETROM. It a 


lways leaves the card 


C354: 






81 


* 


write enabled 


. 




C354: 






^2 


• 










C354:DA 






B3 


RESET LC 


PHX 




;save X 


C355:AE 


JB 


'■■» 


84 






LDX 


ROMSTATE 


;get the state 


C358:3C 


81 


CO 


85 






BIT 


ROM IN, X 


;set bank & ROM/RAM read 


C35B:3C 


Ml 


CO 


86 






BIT 


ROMIN.X 


;set write enable 


C35E:FA 






87 






PLX 




; restore X 


C35F:60 






88 






RTS 






C360: 






89 


* 










C360: 






90 


* 


SETROM 


switch 


es in the ROM 


for reading, the RAM 


C360: 






91 


* 


for writing. 


and it saves t 


he state of the 


C360: 






92 


* 


languag 


e card 


It does not 


save the write 


C360: 






93 


* 


protect 


status of the card. 




C360: 






94 


* 










C360:DA 






95 


SETROM 


PHX 




;save x 


C361:A2 


on 




96 






LDX 


no 


;assume write enable, bank2 ,ROMRD 


C363:2C 


11 


CO 


97 






BIT 


RDLCBNK2 


;ls bank 2 switched in? 


C366:30 


02 


C36A 


98 






BMI 


NOT I 


;=>yes 


C368:A2 


08 




99 






LDX 


#S8 


'.indicate bank 1 


C36A:2C 


12 


CO 


100 


NOT! 


BIT 


RDLCRAM 


;is LC RAM readable? 


C36D-.10 


02 


C371 


101 






BPL 


NOREAD 


;">no 


C36F:E8 






102 






INX 




; indicate RAM read 


C370:E8 






103 






INX 






C371:2C 


81 


CO 


104 


NOREAD 


BIT 


SC081 


;R0M read 


C374:2C 


81 


CO 


105 






BIT 


SC081 


;RAM write 


C377:8E 


78 


04 


106 






STX 


ROMSTATE 


; save state 


C37A:FA 






107 






PLX 




;restore X 


C37B:60 






108 


ROMOK 


RTS 






C37C: 






109 


* 










C37C: 






110 


* 


GETALT 


reads 


a byte from aux memory screenholes. 


C37C: 






111 


* 


Y is th 


e index to the byte 


(0-7) indexed off of 


C37C: 






112 


* 


address 


S478. 






C37C: 






113 


* 










C37C:AD 


L3 


GO 


114 


GETALT 


LDA 


RDRAMRD 


;save state of aux memory 


C37F:OA 






115 






ASL 


A 




C380:AD 


18 


CO 


116 






LDA 


RD80COL 


;and of the 80STORE switch 


C383:08 






117 






PHP 







: 



: 



- 

^ 



^ 



140 



Appendix I: Firmware Listings 



h 
























C384:8D 


00 


CO 


118 






STA 


CLR80COL 


;no 80ST0RE to get page 1 








C387:8D 


03 


CO 


119 






STA 


RDCARDRAM 


;pop In the other half of RAM 






1 — , 


C38A:B9 


78 


04 


120 






LDA 


$478, Y 


;read the desired byte 






• — i 4 


C38D:28 






121 






PLP 




;and restore memory 






1^ 


C38E:B0 


03 


C393 


122 






BCS 


GET ALT 1 










C390:8D 


02 


CO 


123 






STA 


RDMAINRAM 








L 


C393:10 


03 


C398 


124 


CETALT1 


BPL 


GETALT2 








l— J 


C395:8D 


01 


CO 


125 






STA 


SET80COL 








1 * 


C398-.60 






126 


CETALT2 


RTS 












C399: 






127 


* 














}■»-; 


C399:09 


80 




128 


UPSHIFTO 


ORA 


#$80 


;set high bit for execs 






1— I 


C39B:C9 


FB 




129 


UPSHIFT 


CMP 


#$FB 








r 


C39D:B0 
C39F:C9 


06 
El 


C3A5 


130 
131 






BCS 
CMP 


X. UPSHIFT 
*$E1 








1 


C3A1:90 


02 


C3A5 


132 






BCC 


X. UPSHIFT 








S-^ 


C3A3:29 


DF 




133 






AND 


C$DF 








1 


C3A5 : 60 






134 


X 


UPSHIFT RTS 












C3A6: 






135 


* 














R 


C3A6: 






136 


* 


GETCOUT perfo 


rms COUT for GF.TLN. It disables the 






C3A6: 






137 


• 


echoing of control characters by clearing the 






1 


C3A6: 






138 


• 


M.CTL 


node bl 


t, prints the char, then restores 








C3A6: 






139 


* 


M.CTL. 


NOESC 


Is used by the RDKEY routine to 






r-n 


C3A6: 






140 


* 


dlsabl 


e escap 


e sequences. 








5*= 


C3A6: 






141 


* 
















C3A6:48 






142 


GETCOUT 


PHA 




;save char to print 








C3A7:A9 


08 




143 






LDA 


B M.CTL 


;dlsable control chars 






P 


C3A9:1C 


FB 


ii.-. 


144 






TRB 


VMODE 


;by clearing M.CTL 






C3AC:68 






145 






PLA 




;restore character 








C3AD:20 


ED 


FD 


146 






JSR 


COUT 


;and print it 








C3B0:4C 


44 


FD 


147 






JMP 


NOESCAPE 


;enable control chars 






fa 


C3B3: 






148 


* 














■ = 


C3B3: 






149 


* 


STORCH 


determines loads the 


current cursor position, 








C3B3: 






150 


* 




Inverts the character, and displays It 






|_ 


C3B3: 






151 


* 


STORCHAR Inverts the character and displays It at the 






r^j 


C3B3: 






152 


- 




posltl 


on stored In Y 








■ ^ 


C3B3: 






153 


* 


STORY 


determines the current cursor position, and 








C3B3: 






154 


* 




dlspla 


ys the character without Inverting It 






L_ 


C3B3: 






155 


* 


STORE 


displays the char at 


the position in Y 






h* 


C3B3: 






156 


* 














C3B3: 






157 


* 


If mouse characters are enabled (VMODE bit 0=0} 








C3B3: 






158 


* 


then mouse ch 


aracters (S40-S5F) are displayed when 






L_ 


C3B3: 






159 


* 


the alternate 


character set 


is switched in. Normally 






i— u 

■ — 


C3B3: 






160 


* 


values 


S40-$5F are shifted 


:o $0-SlF before display. 






C3B3: 






161 


* 
















C3B3: 






162 


* 


Calls 


to GETCUR 








1 


C3B3: 






163 


* 














M fcj 


C3B3:20 


9D 


CC 


164 


STOJ 


.ISR 


GETCUR 


;get newest cursor Into Y 






1" 


C3B6:80 
C3B8: 


09 


C3C1 


165 

166 


* 




BRA 


STORE 








!^ 


C3B8:20 


9D 


CC 


167 


STORCH 


JSR 


GETCUR 


;flrst, get cursor position 






P 


C3BB:24 


32 




168 






BIT 


INVFLG 


;normal or inverse? 






C3BD:30 


02 


C3C1 


169 






BM1 


STORE 


;=>normal, store it 






I 


C3BF:29 


7F 




170 






AND 


ff$7F 


;inverse It 






fcs 


C3C1:5A 






171 


STORE 


PHY 




;save real Y 






■ a 


C3C2:09 


00 




172 






ORA 


CO 


;does char have high bit set? 








C3C4:30 


15 


C3DB 


173 






BMT 


STORE 1 


;*>yes, don't do mouse check 








C3C6:48 






174 






PHA 




;save char 








C3C7:AD 


FB 


:.', 


175 






LDA 


VMODE 


;ls mouse bit set? 


















Appen 


dtx 1: Firmware Listings 


1 141 





C3CA: 


:6A 






176 




ROR 


A 




C3CB: 


:68 






177 




PLA 




;restore char 


C3CC: 


i90 


OD 


C3DB 


178 




BCC 


STORE 1 


;«>no, don't do mouse shift 


C3CE: 


|2C 


IE 


CO 


179 




BIT 


ALTCHARSET 


;no shift if 11 char set 


C3D1: 


10 


08 


C3DB 


180 




BPL 


STORE 1 


;-> it is! 


C3D3: 


49 


40 




181 




ROR 


#540 


;$40-S5F=>0-$lf 


C3D5: 


i89 


60 




182 




BIT 


#$60 




C3D7: 


iFO 


02 


C30B 


183 




BEO 


STORE 1 




C3D9: 


;49 


40 




184 




EOR 


#$40 




C3DB: 


;2C 


IF 


CO 


185 


ST0RE1 


BIT 


RD80VID 


;80 columns? 


C3DE: 


10 


19 


C3F9 


186 




BPL 


STORE 5 


;»>no, store char 


C3E0: 


:48 






187 




PHA 




;save (shifted) char 


C3E1: 


;8D 


0] 


CO 


188 




STA 


SET80C0L 


;hlt 80 store 


C3E4: 


:98 






189 




TYA 




;get proper Y 


C3E5; 


:45 


20 




190 




EOR 


WNDLFT 


C=l if char in main ram 


C3E7: 


:4A 






191 




LSR 


A 




C3E8; 


:B0 


04 


C3EE 


192 




BCS 


ST0RE2 


;">yes, main RAM 


C3EA: 


:AD 


55 


CO 


193 




LDA 


TXT PAGE 2 


;else flip in aux RAM 


C3ED: 


!C8 






194 




I NY 




;do this for odd left, aux 


C3EE: 


:98 






195 


ST0RE2 


TYA 




;divide pos'n by 2 


C3EF: 


:4a 






196 




LSR 


A 




C3F0 


:A8 






197 




TAY 






C3FI 


:68 






198 




PLA 




;get (shifted) char 


C3F2: 


:91 


28 




199 


STORE 3 


STA 


(BASL).Y 


-.stuff It 


C3F4: 


:2C 


54 


CO 


200 




BIT 


TXTPAGE1 


;else restore pagel 


C3F7; 


;7A 






201 


ST0RE4 


PLY 




; restore real Y 


C3F8 


; t ,M 






202 




RTS 




;und exit 


C3F9; 








203 


* 








C3F9 


:91 


28 




204 


STORES 


STA 


(BASL).Y 


;do 40 column store 


C3FB: 


! 7A 






205 




PLY 




; restore Y 


C3FC: 


60 






206 




RTS 




;and exit 


C3FD: 






0003 


207 




DS 


SC400-*,S00 




WOO: 








21 




INCLUDE MOUSE 


•.Equates for the mouse 



fe= 



"J 



142 



Appendix I: Firmware Listings 



CAOO 




2 


MSB ON 




C400 




3 ******* A***** A****** ******** ************ 




C400 




4 * 






C400 




5 * Mous 


e firmware for the Chels 




C400 




6 * 






C400 




7 * by 


Rich Williams 




C400 




8 * July, 1983 




C400 




9 * 






C400 




10 **************************************** 




C400 




12 **************************************** 




C400 




13 * 






C40O 




14 * Equates 




C400 




15 * 






C400 




16 **************************************** 




C400 




18 * Inpu 


t bounds are in scratch area 




C400 


0478 


19 moutemp equ $478 ;Temporary storage 




C400 


0478 


20 mini 


equ SA78 




C400 


04F8 


21 maxl 


equ SAF8 




coo 


0578 


22 minh 


equ $578 




C400 


05F8 


23 maxh 


equ $5F8 




C400 




2A * Mouse bounds In slot 5 screen area 




C400 


0470 


25 minxl 


equ $A7D 




CAOO 


04FD 


26 rainyl 


equ $AFI) 




C400 


057D 


27 minxh 


equ $570 




C400 


05FD 


28 rainyh 


equ $5FD 




C400 


067D 


29 raaxxl 


equ $670 




C400- 


06FD 


30 raaxyl 


equ $6FD 




CAOO: 


077D 


31 maxxh 


equ $770 




CAOO; 


07FD 


32 tnaxyh 


equ $7F0 




CAOO: 




33 * Mouse holes in slot 4 screen area 




CAOO: 


04 7C 


34 mouxl 


equ $47C ;X position low byte 




CAOO: 


04 FC 


35 mouyl 


equ $4FC ;i position low byte 




CAOO: 


057C 


36 mouxh 


equ $57C ;X position high byte 




CAOO: 


05FC 


37 mouyh 


equ $5FC ;Y posit Lon high byte 




CAOO: 


067C 


38 tnouarm 


equ $67C ;Arm interrupts from movement or button 


CAOO: 


077C 


39 mousta 


t equ 577C ;Mouse status 




CAOO: 




40 * Moustat provides the following 




CAOO: 




Al * 07= 


Button pressed 




CAOO: 




A2 * DB- 


Status of button on last read 




CAOO: 




AS * D5- 


Moved since last read 




CAOO: 




AA * D4= 


Reserved 




CAOO: 




45 * D3= 


Interrupt from VBL 




CAOO: 




46 * 02= 


Interrupt from hutton 




CAOO: 




47 * Dl- 


Interrupt from movement 




CAOO: 




A8 * D0= 


Reserved 




CAOO: 


07FC 


49 raouraode equ S7FC ;Mouse mode 




CAOO: 




50 * 07- 


)4= Unused 




C400: 




51 * D3- 


VBL active 




CAOO: 




52 * 02= 


VBL interrupt on button 




CAOO: 




53 * 01= 


VBL interrupt on movement 




CAOO: 




54 * D0= 


Mouse active 




CAOO: 


0020 


55 movarm 


equ $20 





L 



Appendix I: Firmware Listings 



143 



WOO: 


OOOC 


C40O: 


0004 


C400: 


0002 



56 vblmode equ $0C 

57 butmode equ $04 

58 raovmode equ $02 



CAOO 




60 


* Hardwa 


re addresses 


CAOO 


CO 15 


61 


mouxint 


equ 


SCO 15 


CAOO 


C017 


62 


mouyint 


equ 


$0017 


CAOO 


C019 


hi 


vbltnt 


equ 


$C0 19 


CAOO 


C078 


6A 


ioudsbl 


equ 


SC078 


CAOO 


C079 


65 


iouenbl 


equ 


SC079 


CAOO 


C0A8 


66 


mouclr 


equ 


SC048 


CAOO 


CO 58 


67 


iou 


equ 


SC058 


CAOO 


C058 


66 


moudsbl 


equ 


SC058 


CAOO 


CO 59 


69 


mouenbl 


equ 


SC059 


CAOO 


C063 


70 


moubut 


equ 


SC063 


CAOO 


C066 


71 


mouxl 


equ 


SC066 


CAOO 


C067 


72 


mouyl 


equ 


SC067 


CAOO 


C070 


71 


vblclr 


equ 


SC070 


CAOO 




74 


* 






CAOO 




75 


* Other 


addresses 


CAOO 




76 


* 






CAOO 


0200 


77 


inbuf 


equ 


$200 


CAOO 


021A 


78 


binl 


equ 


inbuf+20 


CAOO 


0215 


79 


binh 


equ 


lnbuf+21 


CAOO 




n 




INCLUDE HCODE 



;"'.' mask 
;Dl mask 



;D7 - x interrupt 
;D7 " y interrupt 
;D7 ■ vbl interrupt 
;Disable iou access 
;Enable iou access 
[Clear mouse interrupt 
I IOU interrupt switches 
;Dlsable mouse interrupts 
[Enable mouse interrupts 
;D7 ■ Mouse button 
;D7 - XI 
;D7 - Yl 
;Clear VBL interrupt 



; Input buffer 

;Temp for binary conversion 







;Mouse @ SCAOO 



L— 



— 

1 



144 



Appendix I: Firmware Listings 



b 

l: 

■ j 

L 

E 

l: 



C400: 






2 


**************************************** 


C400: 






3 


* 








C400: 






4 


* Entry 


points 


for mouse firmware 


C400: 






5 


* 








CAOO: 






6 


**************************************** 


C400:BO 


05 


C407 


7 


rabasic 


bra 


outent 




C402:A2 


03 




8 


p tm 11 


ldx 


#3 




C404:60 






9 




rts 




;Null for pascal entry 


C405:38 






10 


inent 


sec 




;Signature bytes 


C406:90 






11 




dfb 


S90 




C407:18 






12 


outent 


clc 






C408:4C 


.So 


C7 


13 




jmp 


xmbaslc 


Go do basic entry 


C40B:01 






14 




dfb 


Soi 


More signature stuff 


C40C:20 






\ c > 




dfb 


$20 




C40D:02 






16 




dfb 


>pnull 




C40E:02 






17 




dfb 


>pnull 




C40F:02 






18 




dfb 


>pnull 




C410:02 






19 




dfb 


>pnull 




C411:00 






20 




dfb 


so 




C412:3D 






21 




dfb 


>xsetmou 


SETMOUSE 


C413:FC 






22 




dfb 


>xmtstlnt 


SERVEMOUSE 


C414:95 






23 




dfb 


>xmread 


READMOUSE 


C415:84 






24 




dfb 


>xraclear 


CLEARMOUSE 


C416:6B 






25 




dfb 


>noerror 


POSMOUSE 


C417:BO 






26 




dfb 


>xraclamp 


CLAMPMOUSE 


C418:6D 






27 




dfb 


>xmhome 


HOHEMOUSE 


C419:1C 






21 




dfb 


Mnitmouse 


INITMOUSE 


C41A:02 






29 




dfb 


>pnull 




C41B:CF 






30 




dfb 


>xmlnt 








Appendix I: Firmware Listings 



145 



CMC: 






CMC: 






CMC: 






CMC: 






CMC: 






CMC: 






CMC: 






CMC: 






CMC:9C 


7C 


07 


CMF:A2 


*ij 




C421:A0 


01 




CA23:9E 


71. 


M-. 


C426:9E 


7D 


05 


C429:A9 


FF 




C42B:9D 


7D 


06 


C42E:A9 


03 




C430:9D 


7D 


7 


C433:A2 


00 




C435:88 






C436:10 


EB 




C438:20 


6D 


C4 


C43B:A9 


00 





C41C 



C423 



C43D: 

C43D: 

C43D: 

C43D: 

C43D: 

C43D: 

C43D:AA 

C43E:20 A2 C8 

C441:8A 

C442:8D 78 04 

CW:4A 

C446:0D 78 04 

C449:C9 10 

C44B:B0 IF 

C44D:29 05 

C44F:F0 01 

C451:58 

C452:69 55 



CMD 



C46C 



C452 



**************************************** 
* 

* Inttmouse - resets the mouse 

* Also clears all of the mouse holes 

* note that lou access fires pdlstrb & makes mouse happy 



32 
33 

34 
35 

36 

37 * 

38 **************************************** 

39 Inttmouse equ * 

moustat 

#$80 

»\ 

minxl.x 

mtnxh.x 

0SFF 

maxxl.x 

#03 

tnaxxh , x 



40 

41 

42 

43 xrloop 

44 

45 

46 

47 

48 

49 

50 

51 

52 

53 



stz 
ldx 
ldy 
stz 
stz 
Ida 
sta 
Ida 
sta 
ldx 
dey 
bpl 
jsr 
Ida 



;Clear status 

;Minlmum = $0000 
;Haximum =■ $03FF 



PO 

xrloop 

xmhome 
#0 



;Clear the mouse holes 
;Fall into SETMOU 



**************************************** 

* 

* XSETM0U - Sets the mouse mode to A 

* 

**************************************** 



55 
56 

57 
5H 

59 

60 xsetmou 

61 

62 

63 

64 

65 

66 

67 

68 

69 

70 

71 

72 xsoff 



d 

d 



equ 
tax 
jsr 
txa 
sta 
lsr 
ora 
cmp 
bcs 
and 
beq 
cli 
adc 



moveirq 

moutemp 

A 

moutemp 

#$10 

smlnvalid 

#5 

xsoff 

#$55 



;Make sure interrupt vector it 
;0nly x preserved by moveirq 

;D0 - 1 if mouse active 

;D2 - 1 if vbl active 

;lf >-$10 then invalid mode 

; Extract VBL & Mouse 
;Turning it off? 

;lf not, ints active 
;Hake lou byte C-0 



right 



C454 
C454 
C454 
C454 
C454 
C454 
C454 
C454 
C454 
C454 
C454 
C454 



146 



74 
75 

I! 

7* 

19 
BO 

81 
82 
83 

85 



**************************************** 
* 

* SETI0U - Sets the IOU interrupt modes to A 

* Inputs: A = Bits to change 

* D7 » Y int on falling edge 

* D6 = Y int on rising edge 

* D5 - X int on falling edge 

* D4 » X int on rising edge 

* D3 - Enable VBL int 

* D2 - Disable VBL int 

* Dl • Enable mouse int 

* DO = Disable mouse int 



Appendix I; Firmware Listings 



=^ 



j 



J 

J 



L 














L^^J 














h 


C454: 
C454: 


86 * 

87 * 










■■^™* 


C454: 


88 **************************************** 






r* 


C454; C454 
C454:08 


89 aetiou 
90 


equ 

php 


* 






L_ 


C455:78 


91 


sei 


;Don't allow ints while lou enabled 








C456:8E FC 07 


92 


stx 


moumode 






■ -^ 


C459:8D 79 CO 


9 3 


sea 


iouenbl ;Enable lou access 








C45C:A2 08 


94 


ldx 


#8 








C45E:CA 


95 siloop 


dex 








C45F:0A 


96 


asl 


A ;Get a bit to check 






■ — 


C460:90 03 C465 


97 


bec 


sinoch ;No change if C=0 








C462:9D 58 CO 


98 


sta 


iou.x ;Set it 






N 


C465:D0 F7 C45E 


99 slnoch 


bne 


siloop ;Any bits left in A? 






C467:6D 78 CO 


100 


sta 


ioudsbl ;Turn off iou access 






C46A:28 


101 


pip 










C46B:18 


102 noerror 


clc 








N 


C46C:60 


103 sminvalid 


rts 








p 


C46D: 


105 **************************************** 






C46D: 


106 * 












C46D: 


107 * XMHOME- 


Clears mouse position & status 








C46D: 


108 * 










p 


C46D: 


109 **************************************** 






C46D: C46D 


110 xmhome 


equ 


* 








C46D:A2 80 


111 


ldx 


0$8O ; Point mouse to upper left 








C46F:80 02 C473 


112 


bra 


xmh2 






p 


C471:A2 00 


113 xmhloop 


ldx 


#0 






C473:BD 7D 04 


114 xmh2 


Ida 


rainxl. ,x 








C476:9D 7C 04 


115 


sta 


mouxl ,x 






I 


C479:BD 7D 05 


116 


Ida 


minxh.x 






p 


C47C:9D 7C 05 
C47F:CA 


117 
118 


Bta 
dex 


mouxh.x 








C480:10 EF C471 


119 


bpl 


xmhloop 






p 


C482:80 OC C490 


120 


bra 


xmedone 






L 


C484: 


122 **************************************** 






1-3 


C484: 


123 * 










1 


C484: 
C484: 


124 * XMCLEAR 

125 * 


- Set 


s the mouse to 0,0 






1 


C484: 


126 **************************************** 






■ tM 


C484: C484 


127 xmclear 


equ 


* 






1 


C484:9C 7C 04 


128 


stz 


mouxl 






1 


C487:9C 7C 05 


129 


stz 


raouxh 






■ 


C48A:9C FC 04 


130 


stz 


mouyl 






p 


C48D:9C FC 05 


131 


stz 


mouyh 






C490:9C 7C 06 


132 xtncdone 


stz 


mouarm 






1 


C493:18 


133 


clc 








h 


C494:60 


134 


rts 
























Appendix 1: Firmware Listings 


1147 





C495: 

C495: 

C495: 

C495: 

C495: 

C495: C495 

C495:A9 20 

C497:2D 7C 06 

C49A:1C 7C 06 

C49D:2C 63 CO 

C4A0:30 02 C4A4 

C4a2:09 80 

C4A4:2C 7C 07 

C4A7:10 02 C4AB 

C4A9:09 40 

C4AB:8D 7C 07 

C4AE:18 

C4AF:6Q 



136 **************************************** 

137 * 

138 * XHREAD - Updates the screen holes 

139 * 

140 **************************************** 






141 xmread 

142 

143 

144 

145 

146 

147 

148 xrbut 

149 

150 

151 xrbut2 

152 

153 



equ 
Ida 
and 
trb 
bit 
bml 
ora 
bit 
bpl 
ora 
sta 
clc 
rts 



* 

ffmovarm 

mouarm 

mouarra 

moubut 

xrbut 

#$80 

moustat 

xrbut 2 

fl$40 

moustat 



;Has mouse moved? 

;Clear arm bit 
;Button pressed? 



;Pressed last time? 



C 



C4B0: 






155 


************************ 


t*** 


*********** 


C4B0: 






156 


* 












C4B0: 






157 


* 


XMCLAMP 


- Store new bounds 




C4B0: 






158 


* 


Inputs 


A - 1 


for Y, 


for 


X axis 


C4B0: 






159 


* 


mini 


, minh 


, maxl , raaxh 


■ new bounds 


C4B0: 






160 


* 












C4B0: 






161 


**************************************** 


C4B0: 




C4B0 


162 


xmclamp 


equ 


* 






C4B0:6A 






163 






ror 


A 




;1 -> 80 


C4B1:6A 






164 






ror 


A 






C4B2:29 


BO 




165 






and 


#$80 






C4B4:AA 






166 






tax 








C4B5:AD 


78 


04 


167 






Ida 


mini 






C4B8:9D 


7D 


04 


168 






sta 


ratnxl.x 






C4BB:AD 


78 


05 


169 






Ida 


minh 






C4BE:9D 


7D 


05 


170 






sta 


mlnxh.x 






C4C1:AD 


F8 


04 


171 






Ida 


maxl 






C4C4:9D 


7D 


06 


172 






sta 


maxxl,x 






C4C7:AD 


F8 


05 


173 






Ida 


maxh 






C4CA:9D 


7D 


07 


174 






sta 


maxxh.x 






C4CD:18 






175 






clc 






;No error 


C4CE:60 






176 






rts 












. . 



148 



— - 



Appendix I: Firmware Listings 



L 
LZ 

C 

i— i 

l: 

E 

l: 

E 



CACF: 






CACF: 






CACF: 






CACF: 






CACF: 






CACF: 






CACF: 






CACF: 






CACF: 






CACF:AE 


66 


CO 


CAD2 : AC 


67 


CO 


CAD5: 






CAD5:A9 


0E 




CAD7:1C 


7C 


07 


CADA:38 






CADB: 






CADB:AD 


19 


CO 


CADE: 10 


A8 




CAE0:8D 


79 


CO 


CAE3:A9 


OC 




CAE5:2C 


FC 


1.17 


CAE8:D0 


03 




CAEA:8D 


5A 


CO 


CAED:09 


02 




CAEF:80 


LB 





CACF 



CAD5 



C528 



CAED 



CAF1 

CAF3 

CAF6; 

CAF8: 

CAF9: 

CAFA; 

CAFB: 

CAFB: 

CAFC: 

CAFD: 

CAFE: 

C500: 

C501: 

C50A: 

C506: 

C509; 

C50B; 

C50C: 

C50C: 

C50Pi 

C512; 

C51A: 

C516: 

C519: 

C51B: 

C51D: 

C520; 



A9 OE 
2D 7C 
DO 01 
38 

68 

6Q 

Dh 

46 

18 

80 Fl 
FF 

20 AD 
A2 FF 
20 2A 
10 FB 
60 

8D 78 
2C 7C 
DO 02 
A9 OC 
2C 63 
10 02 
A9 OA 
2D FC 
OC 7C 



07 



CO 



CO 



CAF9 

0000 

CAF1 

! 

I 
C506 

C50C 

) 

> 

C516 

) 
C51D 



1 78 **************************************** 




179 * 










180 * Mouse 


interrupt handler 






181 * 










182 * MOUSEINT - Monitor's interrupt handler 




183 * XMINT 


- Interrupt handler 


the user can use 




18A * XMTSTINT - Checks mouse status bits 




j 85 **************************************** 




186 xmint 


equ 


* 






187 


ldx 


mouxl 


;Get XI & Yl asap 




188 


Idy 


mouyl 






189 mouseint 


equ 


* 


;Entry point if X & Y set up 




190 


Ida 


tf$0E 


; Clear status bits 




191 


trb 


moustat 






193 


sec 




;Assume interrupt not handled 




19A * Check 


for vertical blankl 


ng interrupt 




195 


Ida 


vblint 


;VBL Interrupt? 




196 


bpl 


chkmou 






197 


sta 


louenbl 


;Enable iou access & clear VBL Interrupt 




198 


Ida 


Cvblmode 


; Should we leave vbl active? 




199 


bit 


moumode 






200 


bne 


cvnovbl 






201 


sta 


iou+2 


;Disable VBL 




202 cvnovbl 


ora 


ffmovmode 






203 


bra 


xmskip 






205 mistat 


Ida 


#S0E 






206 


and 


moustat 






207 


bne 


Host at 2 






208 


sec 








209 nostat2 


pla 








210 


rts 








211 


ds 


SCAFB-* 






212 


dfb 


SD6 


jSignature byte 




213 xmtstint 


pha 








214 


clc 








215 


bra 


mistat 


;Go check status 




216 


dfb 


SFP 






217 


Jsr 


zzqult 


;Get out of the hooks 




218 


ldx 


tfSFF 






219 qloop 


Jar 


xznra2 






220 


bpl 


qloop 






221 


rts 








222 xmskip 


equ 


* 






223 


sta 


ioudsbl 






22A 


bit 


mo u arm 


;VBL bit in arm isn't used 




225 


bne 


cvmoved 






226 


Ida 


tfvblmode 


; Didn't move 




227 cvTBOved 


bit 


moubut 


; But ton pressed? 




228 


bpl 


cvbut 






229 


eor 


fbutmode 


;Clear the button bit 




230 cvbut 


and 


moumode 


;Which bits were set in the mode 




231 


tsb 


moustat 








Appendix 1: Firmware Listings 1 149 





C523:1C 


7C 


06 


232 




trb 


raouarm 




C526:69 


fe 




233 




adc 


*SFE 


;C-1 if int passes to user 


C528: 






234 


* Check 


& update mouse movement 


C528: 




C528 


235 


chkmou 


equ 


* 




C528:AD 


15 


CO 


236 




Ida 


mouxlnt 


; Mouse Interrupt? 


C52B:OD 


17 


CO 


237 




ora 


mouylnt 




C52E:10 


6A 


C59A 


238 




bpl 


xmdone 


; If not return with C from 


C530:8A 






239 




txa 




;Get XI in A 


C531:A2 


00 




240 




Ldx 


#0 




C533:2C 


IS 


CO 


241 




bit 


mouxlnt 


;X movement? 


C536:30 


OA 


C542 


242 




bral 


cmxmov 




C538:98 






243 


cmloop 


cya 




;Get Yl into A 


C539:49 


8Q 




244 




eor 


#$80 


;Complement direction 


C53B:A2 


HI) 




245 




ldx 


#$80 




C53D:2C 


1 ' 


CO 


246 




bit 


mouyint 




C540:10 


39 


C57B 


247 




bpl 


cmnoy 




C542:0A 






248 


cmxraov 


asl 


A 




C543:BD 


7C 


06 


249 




Ida 


mouxl , .* 


;A = current low byte 


C546:B0 


1A 


C562 


250 




bca 


crarght 


; Which way? 


C543:DD 


7D 


04 


251 




cmp 


mlnxl.x 


;Move left 


C54B:D0 


08 


C555 


252 




bne 


cmlok 




C54D:BD 


7C 


05 


253 




Ida 


mouxh.x 




C550:DD 


7D 


05 


254 




cmp 


minxh.x 




C553:FO 


22 


C577 


255 




beq 


cmnolnt 




C555:BD 


7C 


04 


256 


cmlok 


Ida 


mouxl, x 




C558:D0 


03 


C55D 


257 




bne 


cmntO 


; Borrow from high byte? 


C55A:DE 


7C 


05 


258 




dec 


mnuxti ,x 




C55D:DE 


7C 


04 


259 


cmntO 


dec 


mouxl ,x 




C560:80 


15 


C577 


260 




bra 


cmnolnt 




C562:DD 


7n 


06 


261 


cmrght 


cmp 


maxxl ,x 


;At high bound? 


C565:D0 


08 


C56F 


262 




bne 


cmrok 




C567:BD 


7C 


05 


263 




Ida 


mouxh.x 




C56A:DD 


7D 


07 


264 




cmp 


maxxh.x 




C56D:F0 


OH 


C577 


265 




beq 


cmnolnt 




C56F:FE 


7C 


04 


266 


cmrok 


lnc 


mouxl, x 


;Move right 


C572:DO 


03 


C577 


267 




bne 


cmnolnt 




C574:FE 


7C 


05 


268 




inc 


mouxh, x 




C577:EO 


00 




269 


cmnolnt 


cpx 


00 




C579:FO 


BD 


C538 


270 




beq 


cmloop 




C57B:8D 


48 


CO 


271 


cmnoy 


sta 


mouclr 




C57E:A9 


02 




272 




Ida 


"movmode 


; Should we enable VBL? 


C580:2D 


FC 


07 


273 




and 


mouraode 




C583:FO 


09 


C58E 


274 




beq 


cmnovbl 


;Branch if not 


C585:8D 


79 


CO 


275 




sta 


iouenbl 




C588:8D 


5B 


CO 


276 




sta 


iou+3 


;Enable VBL int 


C58B:8D 


7H 


CO 


277 




sta 


ioudsbl 




C58E:09 


20 




278 


cmnovbl 


ora 


"movarm 


;Mark that we moved 


C590:0C 


7C 


06 


279 




tsb 


mo u arm 




C593:A9 


OK 




280 




Ida 


ffSOE 




C595:2D 


7C 


7 


281 




and 


moustat 




C598:69 


FE 




282 




adc 


"$FE 


;C-1 iff any bits were 1 


C59A:60 






283 


xmdone 


rts 







e: 



- 






150 






d 



Appendix I: Firmware Listings 



L 


















■ M 




















C59B: 




285 


**************************************** 


L 


C59B: 




286 


* 










■ -1 
1 — 


C59B: 




287 


* HEXTODEC - P 


uts +0000 


into the input buffer 


C59B: 




288 


* Inputs: A = 


Low byte 


of 


number 




C59B: 




289 


* 


X - 


High byte of 


number 


L 


C59B: 




290 


* 


Y = 


Position 


of 


>nes digit 


■- | 


C59B: 




291 


* 










C59B: 




292 


**************************************** 




C59B: 


C59B 


293 


hextodec 


equ 


* 






L 


C59B:E0 80 




294 




cpx 


#$80 




; Is it a negative number? 


■ ,■ 


C59D:90 0D 


C5AC 


295 




bcc 


hexdec2 






■ — 


C59F:49 FF 




296 




eor 


#$FF 




;Form two's complement 




C5A1:69 00 




297 




adc 


#0 




;C = 1 from compare 


h 


C5A3:48 




298 




pha 






;Save it 


C5A4:8A 




299 




txa 








C5A5:49 FF 




300 




eor 


#$FF 








C5A7:69 00 




301 




adc 


#0 






r^a 


C5A9:AA 




302 




tax 








p 


C5AA:68 
C5AB:38 




303 
304 




pla 
sec 










C5AC:8D 14 


02 


305 


hexdec2 


ata 


binl 




;Store the number to convert 


■—a 


C5AF:8E 15 


02 


306 




stx 


binh 






! j- 


C5B2.-A9 AB 




307 




Ida 


#•+• 




;Store the sigh in the buffer 




C5B4:90 02 


C5B8 


308 




bcc 


hdpos2 








C5B6:A9 AD 




309 




Ida 


tf.-' 






p 


C5B8:48 




310 


hdpos2 


pha 






;Save the sign 


C5B9:A9 AC 




311 




Ida 


»v 




;Store a comma after the number 




C5BB:99 01 


02 


312 




sta 


lnbuf+1. 


y 






C5BE: 


C5BE 


313 


hdloop 


equ 


* 




;Divide by 10 


p 


C5BE: 
C5BE: 




314 

315 


* 

* Divide 


BINH.L by 10 ar 


d leave remainder in A 




C5BE: 




316 


* 










L 


C5BE:A2 11 




317 




ldx 


#16+1 




; 16 bits and first time do nothing 


■ — 


C5C0:A9 00 




318 




Ida 


fro 






C5C2:18 




319 




clc 






;O0 so first ROL leaves A»0 




C5C3:2A 




320 


dvlOloop 


rol 


A 






u 


C5C4:C9 OA 




321 




cop 


#10 




;A >- 107 


C5C6:90 02 


C5CA 


322 




bcc 


dviOlt 




; Branch if < 


C5C8:E9 OA 




323 




sbc 


#10 




;C = 1 from compare and is left set 




C5CA:2E 14 


02 


324 


dviOlt 


rol 


binl 






JLJ 


C5CD:2E 15 


02 


325 




rol 


binh 






C5D0:CA 




326 




dex 








1 


C5D1:D0 FO 


C5C3 


327 




bne 


dvlOloop 








C5D3:09 BO 




328 




ora 


9'0' 




;Make a ascil char 


1 


C5D5:99 00 


02 


329 




sta 


inbuf ,y 






■ 


C5D8:88 




330 




dey 








i 


C5D9:FO 08 

C5DB:C0 07 


C5E3 


331 
332 




beq 
cpy 


hddone 
#7 




;Stop on 0,6,12 


■ 


C5DD:F0 OA 


C5E3 


333 




beq 


hddone 






1 


C5DF:C0 OE 




334 




cpy 


#14 






C5E1:D0 DB 


C5BE 


335 




bne 


hdloop 






1 


C5E3:68 




336 


hddone 


pla 






;Get the sign 


F3 


C5E4:99 00 
C5E7:60 


02 


337 
338 




sta 
rts 


inbuf ,y 








C5E8:DF 67 


37 1C 


339 


qtbl 


dfb 


SDF.S67, 


S37 


$1C,S07,S0C,$45,$62 


1 


C5F0:6E 7E 


3B OA 


340 




dfb 


S6E.S7E, 


$3B 


S0A,S0B,$48,$77,$7B 


^3 

1^ 


C5F8:66 2B 


OC 08 


341 




dfb 


S66.S2B, 


S0C 


S08,$16,S53,S68,SC5 


C600: 


0000 


342 




da 


SC600-* 






h 


























Appendix 1: Firmware Listings 1 1 51 



C600: 
C600: 
C600: 
C600: 
C600: 
C600: 
C600: 
C602: 
C604: 
C606.: 
C608: 
C60A: 
C60B: 
C60D: 
C60F: 
C610: 
C613: 
C616: 
C617: 
C61A: 
C61D: 
C61F: 
C622: 
C623: 
C625: 
C626: 
C628: 
C629: 
C62C: 
C62E: 
C631: 
C632: 
C634: 
C636: 
C638: 
C63A: 
C63D: 
C63F: 
C640: 
C641: 
C642: 
C644: 
C646: 
C648: 
C64B: 
C64E 
C650 
C653 
C654 
C656 
C657 
C658 
C65A 
C65C 
C65E 
C65E 
C65E 
C65E 



0356 
0300 
07DB 
002B 
003C 
004 F 



A2 20 
A0 00 
64 03 
64 3C 
A9 60 
AA 

86 2B 
85 4F 
5A 

BD 8E 
BD 8C 
7A 

B9 EA 
BD 89 
AO 50 
BD 80 
98 

29 03 
OA 

05 2B 
AA 

BD 81 
A9 56 
:20 A8 
:88 

; 10 EB 
:85 26 
:85 3D 
:85 41 
:20 09 
:64 03 
: 18 
:08 
:28 

:A6 2B 
:C6 03 
:D0 OE 
:BD 88 
:BD CF 
:10 FE 
:9D 7B 
:E8 

:80 F5 
:08 
:88 

:D0 04 
:F0 E5 
:80 DF 



CO 
CO 

CO 

CO 

CO 



CO 

re 



C61F 



C7 



C656 



CO 



C64E 



07 



C64B 



C65E 
C641 
C63D 



DNIBL 

NBUF1 

BOOTSCRN 

SLOTZ 

BOOTTMP 
8 BOOTDEV 
9 
10 
11 
12 
13 
14 

15 DRV2ENT 
16 
17 
L8 
19 

20 

21 

22 

23 

24 SEEKZERO 

25 

26 

27 

28 

29 

30 

31 

32 

33 

34 

35 

36 

37 

38 

39 EXTENT 1 

40 RDADR 
41 

42 RETRY 1 

43 RDDHDR 
44 

45 

46 FUGIT 

47 FUG1 

48 HANGING 
49 

50 
51 

52 RDHDO 

53 RETRY 
54 

55 

56 EXTENT 
* 



EOU 
EQU 
EQU 
EQU 
EQU 
EQU 
LDX 
LDY 
STZ 
STZ 
LDA 
TAX 
STX 
STA 
PHY 
LDA 
LDA 
PLY 
LDA 
LDA 
LDY 
LDA 
TYA 
AND 
ASL 
ORA 
TAX 
LDA 
LDA 
JSR 
DEY 
BPL 
STA 
STA 
STA 
JSR 
STZ 
CLC 
PHP 
PLP 
LDX 
DEC 
BNE 
LDA 
LDA 
BPL 
STA 
I NX 
BRA 
PHP 
DEY 
BNE 
BEQ 
BRA 



57 
58 
59 
60 



****** 

* The following 

* present form. 

* cause volcano 



$356 

S300 

S7DB 

$2B 

S3C 

S4F 

#$20 

#$00 

$03 

S3C 

#$60 

SLOTZ 

BOOTDEV 

SC08E.X 
SC08C.X 

SCOEA.Y 
SC089.X 
#$50 
SC080.X 

#$03 

A 
SLOTZ 

$C081,X 

#$56 

WAIT 

SEEKZERO 

$26 

$3D 

$41 

HAKTBL 

$03 



SLOTZ 

$03 

RDHDO 

SC088.X 

MSC-$60,X 

HANGING 

B0OTSCRN-$60,X 

FUG1 



RDHD1 
RETRY 1 

EXTENT 1 

***********! 

code is sacred In It's 

To change It would 
! to errupt, the ground 



;Y-1 IF DRIVE 2 BOOT, ELSE Y-0 



; SELECT DRIVE 1 OR 2 



RESTORE X TO $60 

UPDATE RETRY COUNT 

BRANCH IF NOT OUT OF RETRIES 

SHUT OFF DISK AND QUIT! 

(X STARTS AT $60) 

HANG, HANG, HANG! 



3 

"J 
I 



— - 

"J 

U 
I 

U 



152 



Appendix I: Firmware Listings 



L 

l: 
l: 
l: 
l: 

E 
fc 

L 

■ M 



C65E: 






M 


* co shake , and 


C65E: 






t>> 


* * * * 


* * * * 


C65E:BD 


8C 


CO 


63 


RDHDl 


LDA 


C661:10 


FB 


C65E 


64 




BPL 


C663:49 


D5 




65 


ISMRK1 


EOR 


C665:D0 


FO 


C657 


66 




BNE 


C667:BD 


8C 


CO 


67 


RDHD2 


LDA 


C66A:10 


FB 


C667 


68 




BPL 


C66C:C9 


AA 




69 




CHP 


C66E:D0 


F3 


C663 


70 




BNE 


C670:EA 






71 




NOP 


C671:BD 


8C 


CO 


7 2 


RDHD3 


LDA 


C674:10 


FB 


C671 


73 




BPL 


C676:C9 


96 




H 




CMP 


C678:F0 


09 


C683 


75 




BEO 


C67A:28 






76 




PLP 


C67B:90 


C2 


C63F 


77 




BCC 


C67D:49 


AD 




7 P. 




EOR 


C67F:FO 


25 


C6A6 


79 




BEQ 


C681:D0 


BC 


C63F 


SO 




BNE 


C683:AO 


03 




81 


RDSECT 


LDY 


C685:85 


40 




a 2 


RDSEC1 


STA 


C687:BD 


8C 


CO 


83 


RDSEC2 


LDA 


C68A:10 


FB 


C687 


84 




BPL 


C68C:2A 






B5 




ROL 


C68D:85 


3C 




86 




STA 


C68F:BD 


8C 


CO 


87 


RDSEC3 


LDA 


C692:10 


FB 


C68F 


88 




BPL 


C694:25 


3C 




B9 




AND 


C696:88 






90 




DEY 


C697:DO 


EC 


C685 


91 




BNE 


C699:28 






92 




PLP 


C69A:C5 


3D 




93 




CMP 


C69C:DO 


A! 


C63F 


94 




BNE 


C69E:A5 


Vi 




95 




LDA 


C6AO:C5 


ft] 




96 




CHP 


C6A2:D0 


9B 


C63F 


97 


BADRD1 


BNE 


C6A4:B0 


9C 


C642 


98 




BCS 


C6A6:AO 


56 




99 


RDATA 


LDY 


C6A8:8A 


3C 




100 


RDATO 


STY 


C6AA:BC 


8C 


CO 


101 


RDAT1 


LDY 


C6AD:10 


FB 


C6AA 


102 




BPL 


C6AF:59 


D6 


02 


103 




EOR 


C6B2:A4 


3C 




104 




LDY 


C6B4:88 






105 




DEY 


C6B5:99 


00 


03 


106 




STA 


C6B8:D0 


EE 


C6A8 


107 




BNE 


C6BA:84 


JC 




108 


RDAT2 


STY 


C6BC:BC 


8C 


CO 


109 


RDAT3 


LDY 


C6BF:10 


FB 


C6BC 


no 




BPL 


C6C1:59 


D6 


02 


111 




EOR 


C6C4:A4 


3C 




112 




LDY 


C6C6:9I 


26 




113 




STA 


C6C8:C8 






114 




INY 


C6C9:D0 


EF 


C6BA 


115 




BNE 


C6CB:BC 


8C 


CO 


116 


RDAT4 


LDY 


C6CE:10 


FB 


C6CB 


117 




BPL 


C6D0:59 


D6 


02 


118 




EOR 



ProDOS not to boot! * 

************* 

SC08C.X 

RDHDl 

*SD5 

RETRY 

SC08C.X 

RDHD2 

tfSAA 

1SMRK1 

SC08C.X 
RDHD3 
*$96 
RDSECT 

RDADR 

0SAD 

RDATA 

RDADR 

ff$03 

S40 

SC08C.X 

RDSEC2 

A 

BOOTTMP 

SC08C.X 

RDSEC3 

BOOTTMP 

RDSEC1 

S3D 

RDADR 

$40 

$41 

RDADR 

RDDHDR 

#$56 

BOOTTMP 

SC08C.X 

RDAT1 

DNIBL-S80.Y 

BOOTTMP 

NBUF1 ,Y 

RDATO 

BOOTTMP 

SC08C.X 

RDAT3 

DNIBL-S80.Y 

BOOTTMP 

($26),Y 

RDAT2 
$C08C,X 
RDAT4 
DNIBL-$80,Y 



Appendix I: Firmware Listings 



153 



C6D3 : DO 


CD 


C6A2 


119 


BADREAD 


BNE 


BADRD1 


C6D5:A0 


00 




120 




LDY 


#500 


C6D7:A2 


56 




121 


DENIBL 


LDX 


#$56 


C6D9:CA 






122 


DENIB1 


DEX 




C6DA:30 


FB 


C6D7 


123 




BMI 


DENIBL 


C6DC:B1 


26 




126 




LDA 


(526), Y 


C6DE : 5E 


00 


03 


125 




LSR 


NBUFl.X 


C6E1 : 2A 






126 




ROL 


A 


C6E2:5E 


00 


03 


127 




LSR 


NBUFl.X 


C6E5:2A 






128 




ROL 


A 


C6E6:91 


26 




129 




STA 


($26), Y 


C6E8:C8 






130 




INY 




C6E9 : DO 


EE 


C6D9 


131 




BNE 


DENIBl 


C6EB: 






132 


ft * * * * 


i * * i 


********** 


C6EB: 






133 


* Code beyond i 


this point is not * 


C6EB: 






134 


* sacred. 


... It 


may be perverted * 


C6EB: 






135 


* in any 


manner by any pervert. * 


C6EB: 






136 


* * * * t 


1**1 


********** 


C6EB:E6 


11 




137 




INC 


S27 


C6ED:E6 


3D 




138 




INC 


S3D 


C6EF:A5 


3D 




139 




LDA 


S3D 


C6F1:CD 


00 


OH 


140 




CMP 


$0800 


C6F4:A6 


4F 




141 




LDX 


BOOTDEV 


C6F6:90 


DB 


C6D3 


142 




BCC 


BADREAD 


C6F8:4C 


01 


08 


143 




JMP 


$0801 


C6FB:4C 


OB 


C6 


144 


DODRV2 


JMP 


DRV2ENT 


C6FE: 




0002 


145 




DS 


$C700-*,0 


C700:PF 






146 




DFB 


SFF ;MAKE IT LOO 


C701:A9 


EO 




147 


DRV2B00T 


LDA 


#$E0 ;FOR DEVICE 


C703:AO 


01 




148 




LDY 


#1 ;TO SELECT C 


C705:A2 


60 




149 




LDX 


#$60 


C707:80 


F2 


C6FB 


150 




BRA 


D0DRV2 


C709:A2 


03 




151 


HAKTBL 


LDX 


C$03 


C70B:AO 


00 




152 




LDY 


#0 


C70D:66 


3C 




153 


TBLLOOP 


STX 


BOOTTMP 


C70F:8A 






154 




TXA 




C710:OA 






155 




ASL 


A 


C711:24 


3C 




156 




BIT 


BOOTTMP 


C7I3:FO 


IG 


C725 


157 




BEQ 


NOPATRN 


C715:05 


3C 




158 




ORA 


BOOTTMP 


C717:49 


PP 




159 




EOR 


|C$FF 


C719:29 


n 




160 




AND 


ff$7E 


C71B:BO 


08 


C725 


161 


TBLL00P2 


BC5 


NOPATRN 


C71D:AA 






162 




LSR 


A 


C7lE:DO 


FR 


C71B 


163 




BNE 


TBLL00P2 


C720:98 






164 




TYA 




C721-.9D 


56 


3 


165 




STA 


DNIBL.X 


C724:C8 






166 




I NY 




C725:E8 






167 


NOPATRN 


I NX 




C726:10 


E5 


C70D 


168 




BPL 


TBLLOOP 


C728:A9 


08 




169 




LDA 


#$08 


C72A:85 


27 




170 




STA 


$27 


C72C:AO 


7F 




171 




LDY 


#$7F 


C72E:60 






172 




RTS 




C72F: 




C72F 


173 


MSG 


EQU 


* 


C72F: 






174 




MSB 


ON 


C72F:C3 


E8 


E5 E3 


175 




ASC 


'Check Disk Drive. * 


C740: 






176 


* 










n 

RIVE 2 



L 

k— I 



- 
e 



J 



154 



Appendix I: Firmware Listings 



j 



L 

l: 

■ a 

l: 

■ M 



! 



C740; 
C740: 
C740: 
C740: 
C740: 
C740: 
C740: 
C740; 
C740: 
C743: 
C746; 
C749: 
C74C: 
C74F: 
C752; 
C752: 
C754: 
C756: 
C758: 
C75A: 
C75D: 
C75E: 
C760: 
C762: 
C763: 
C764: 
C766: 
C769: 
C76B: 
C76E: 
C771: 
C772: 
C773: 
C775: 
C776: 
C778: 
C77A: 
C77C: 
C77D: 
C77E: 
C780: 
C780: 



08 50 
00 02 
SB 8B 

09 50 
00 03 
83 83 

64 00 
E6 00 
E6 00 
92 00 
9D 00 
6A 

E6 00 
DO F6 
18 
98 

AO 08 
BE 40 
90 03 
BE 49 
9D 00 
2A 
88 

10 Fl 
A8 

BO DA 
E6 01 
DO DC 
38 

ca 

80 E3 



CO 



C7 
i 

c; 

CO 



C758 

f 

C76E 

r 

) 

C766 

C752 
C758 



C763 
0000 



177 
178 
179 
180 
181 
182 
183 
184 
185 
186 
187 
188 
189 
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
204 
205 
206 
207 
208 
209 
210 
211 
212 
213 
214 
215 
216 
217 
24 



The following code Is Teri's memory and 
soft switch exercise program. The only 
purpose Is exercise, not diagnostic 
functions. This code is activated on 
a system without a keyboard, or when 
both open and closed apple keys are 
pressed during the reset sequence. 



TBL1 



TBL2 



- 

XI. OOP 1 



3CPAGE 



XM0DE 
XRSET 

XRST1 



BANGEK 



$08,550, $52 
S00,S02,S04 
S8B,S8B,SE8 
$09,$50,S52 
$00,$03,S05 
S83,583,SE8 

soo 

$00 

$00 

($00) 

$C000,X 

A 

$00 

XPAGE 



#$08 

TBL1.Y 

XRSTl 

TBL2.Y 

$C000,X 

A 

XRSET 

XLOOPl 
$01 

XPAGE 



XMODE 
SC780-* 



DFB 
DFB 
DFB 
DFB 
DFB 
DFB 

STZ 
INC 
INC 
STA 

STA 

ROR 

INC 

BNE 

CLC 

TYA 

LDY 

LDX 

BCC 

LDX 

STA 

ROL 

DEY 

BPL 

TAY 

BCS 

INC 

BNE 

SEC 

INY 

BRA 

DS 

INCLUDE MBASIC 



; 'these are low order 

j addresses of $C0XX 

; that must be re-selected 

; after each page write 

; (especially SCOOO!) 



;Reset low address to 2 
;H1 addr assumed to = 

;Write entire page with 
; shifted data. .. BUT 
; restore Z-page after 
; write in case SC008-9 
; is current pointer 
; Indicates regular pass 
;Get settings, each bit 
;Speclfles main/alt set 
; Assume Main $C000 setting 
;Branch if Main setting 
;Else get Alternate index 

; Accumulator makes full 
; circle 

;Preserve settings In Y 
;Branch if new setting 

;Loop til all pages wrlten 
; Indicate new settings, 
; reset mem pointer after 
; after new settings 

;Mouse BASIC routines G$C7B0 



Appendix I: Firmware Listings 



- 



C780: 

C780: 

C780: 

C780: 

C780: 

C780: 

C780: 

C781: 

C783: 

C785: 

C787: 

C789; 

C78B: 

C78D: 

C78E: 

C78F: 

C79I: 

C793 

C795 

C798 

C79B 

C79C 

C79D 

C79E 



7 KM 



:5A 

:B0 1C 

:A0 C4 

:C4 39 

:D0 04 

;A4 38 

:F0 12 

:DA 

:48 

:29 7F 

:C9 02 

:B0 06 

:20 3D C4 

:20 6D C4 

:68 

:FA 

:7A 

:60 



C79F 



G78D 



C79F 



C79B 



3 **************************************** 

4 * 

5 * XWBASIC - Basic call to the mouse 

6 * 

7 **************************************** 



8 xmbaBlc 

9 
10 
11 
12 
13 
14 
15 

16 xmbout 
17 
18 
19 
20 
21 
22 

23 mbbad 
24 
25 
:'.h 



equ 

phy 
bcs 
ldy 
cpy 
bne 
ldy 
beq 
phx 
pha 
and 
cmp 
bge 
jsr 
jsr 
pla 
Plx 

Ply 

rts 



baslcln 

#<mbaslc 

kswh 

xmbout 

kswl 

baslcln 



*S7F 

n 

mbbad 

xsetmou 

ROthou 



; Input? 

; Input from SC400? 



;Save X too 
;We don't care about high bit 
;0nly 0,1 valid 



— 



— — 



C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F: 

C79F:91 28 

C7A1:A9 05 

C7A3:85 38 

C7A5:AD 00 CO 

C7A8:0A 

C7A9:08 

C7AA:78 

C7AB:20 95 C4 

C7AE:A0 05 

C7B0:AE 7C 05 

C7B3:AD 7C 04 

C7B6:20 9B C5 

C7B9:A0 0C 

C7BB:AE FC 05 

C7BE:AD FC 04 



**************************************** 
* 

BASICIN - Input from basic 



C79F 



156 



28 

29 
30 

31 
32 
33 
34 

35 

36 
37 
»8 
39 

.;.! 
41 
42 **************************************** 



Creates +XXXXX.+YYYYY.+SS 
XXXXX - X position 
YYYYY = Y position 
SS - Status 

- = Key pressed 

1 = Button pressed 

2 = Button just pressed 

3 ■ Button just released 

4 = Button not pressed 



43 basicln 

44 

45 

46 

47 

48 

49 

50 

51 

52 

53 

54 

55 

56 

57 

58 



equ 
sta 
Ida 
sta 
Ida 
asl 
php 
sel 
jsr 
ldy 
ldx 
Ida 
jsr 
ldy 
ldx 
Ida 



(basl),y 

OMnent 

kswl 

kbd 

A 



xmread 

#5 

mouxh 

mou x I 

hextodec 

#12 

mouyh 

mouyl 



;Fix flashing char 
;Flx Input entry 

;test the keyboard 

;Save kbd and lnt stat for later 

;No Interrupts while getting position 

;Move X position into the buffer 



;Convert It 



Appendix I: Firmware Listings 



i 

i 

i 

i 
J 



! 












L 


C7CI:20 9B C5 


59 


Jsr 


hextodec 




C7C4:AD 7C 07 
C7C7:2A 


60 
61 


Ida 
rol 


raoustat 
A 




l: 


C7C8:2A 
C7C9:2A 
C7CA:29 03 


62 
63 
64 


rol 
rol 
and 


A 
A 
#3 




■ 4 


C7CC:49 03 


65 


eor 


#3 




iz 


C7CE:1A 


66 


Inc 


A 




C7CF:28 


67 


pip 


;Restore lnt & kbd status 




C7D0:A0 10 


68 


Idy 


#16 






C7D2:20 AC C5 


69 


isr 


hexdec2 ;X=0 from last divlO 




l: 


C7D5:7A 
C7D6:A2 11 


71 


ply 

Ldx 


#17 ;X - EOL 




C7D8:A9 8D 


72 


Ida 


#S8D ;Carriage return 




l* 


C7DA:9D 00 02 
C7DD:60 


73 putinbuf 
74 


sta 

rts 


inbuf ,x 




b 












L 


C7DE: 


76 **************************************** 




C7DE: 


77 * 








C7DE: 


78 * PADDLE 


patch 






C7DE: 


79 * 








L 


C7DE: 


30 **************************************** 




C7DE: C7DE 


Rl rapaddle 


equ 


* 




C7DE:AD FC 07 


82 


Ida 


moumode ;ls the mouse active? 




C7E1:C9 01 


B 1 


cmp 


#01 ;Only transparent mode 






C7E3:F0 06 C7EB 


94 


beq 


pdon 






C7E5:AD 70 CO 


95 


Ida 


vblclr ;Flre the strobe 




Z 


C7E8:AC 21 FB 


86 


jmp 


SFB21 




5~= 


C7EB: C7EB 


87 pdon 


equ 


* 






C7EB:E0 01 


86 


cpx 


*1 ;C-1 If X-l 






C7ED:6A 


BS 


ror 


A ;A-80 or 




r-a 


C7EE:A8 


90 


tay 








C7EF:B9 7C 05 


91 


Ida 


mouxh.y ;Get high byte 






C7F2:FO 02 C7F6 


92 


beq 


pdok 




L 


C7F4:A9 FF 


93 


Ida 


#SFF 




c 


C7F6:19 7C 04 


94 pdok 


oca 


mouxl ,y 




C7F9:A8 
C7FA:60 
C7FB:5D E8 C5 


95 
96 
97 zznml 


tay 
rts 
eor 


qtbl.x 




■ 

l: 

■ _M 


C7FE:80 DA C7DA 


98 


bra 


putinbuf 




C800: 0000 


99 


ds 


$C800-*,0 




C800: 


25 


INCLUDE IR0BUF ; Interrupt stuff @SC800 














\ 

r 
















Appendix 1: Firmware Listings 


1 157 



C800: 






3 


* 






C800: 






4 


* this Is 


the main (only) I 


C800: 






5 


* 






C800:4C 


E4 


CI 


6 




jmp 


plinit 


C803:48 






7 


NEW IRQ 


PHA 




C804:68 






a 




PLA 




C805:68 






9 




PLA 




C806:48 






10 


IRQ1 


PHA 




C807:D8 






11 




CLD 




C808:29 


LC 




12 




AND 


ffSlO 


C80A:69 


FO 




13 




ADC 


"SFO 


C80C:8A 






; \ 




TXA 




G80D:BA 






15 




TSX 




C80E:CA 






lh 




DEX 




C80F:9A 






17 




TXS 




C810:48 






18 




PHA 




C8I1:SA 






19 




PHY 




C812:AE 


66 


CO 


20 




LDX 


M0UX1 


C815:AC 


67 


CO 


21 




LDY 


M0UY1 


C818:AD 


18 


CO 


:i 




LDA 


RD80COL 


C81B:2D 


1C 


CO 


23 




AND 


RDPAGE2 


C81E:29 


80 




24 




AND 


#$80 


C820:F0 


05 


C827 


25 




BEQ 


IRQ2 


C822:8D 


54 


CO 


Z6 




STA 


TXT P AGE 1 


C825:A9 


40 




27 




LDA 


fl$40 


C827-.2C 


13 


CO 


28 


IRQ2 


BIT 


RDRAMRD 


C82A:10 


05 


C831 


29 




BPL 


IRQ3 


C82C:8D 


02 


CO 


30 




STA 


RDMAINRAM 


C82F:09 


20 




31 




ORA 


#$20 


C831:2C 


14 


CO 


32 


IRQ3 


BIT 


RDRAMWRT 


C834:10 


05 


C83B 


33 




BPL 


IRQ4 


C836:8D 


04 


CO 


34 




STA 


WRMAINRAM 


C839:09 


10 




35 




ORA 


#$io 


C83B:B0 


13 


C850 


36 


IRQ4 


BCS 


IR05 


C83D:4B 






37 




PHA 




C83E:20 


D5 


C4 


38 




JSR 


MOUSE INT 


C84l:90 


3F 


C882 


19 




BCC 


IRQDONE 


C843:20 


00 


C9 


40 




JSR 


ACT AT NT 


C846:90 


3A 


C882 


41 




BCC 


IRQDONE 


C848:68 






42 




PLA 




C849:1B 






43 




CLC 




C84A:80 


04 


C850 


44 




bra 


passkipl 


C84C: 




0001 


45 




d& 


SC84D-*.S00 


C84D:4C 


BE 


CI 


46 




jmp 


pi read 


C850: 




C850 


47 


passklpl 


equ 


* 


C850:2C 


12 


CO 


48 


1RQ5 


BIT 


RDLCRAM 


C853:10 


OC 


C861 


49 




BPL 


IR07 


C855:09 


OC 




50 




ORA 


flSC 


C857r2C 


11 


CO 


51 




BIT 


RDLCBNK2 


C85A:10 


02 


C85E 


52 




BPL 


TRQ6 


C85C:49 


06 




53 




EOR 


#$6 


C85E:8D 


81 


CO 


54 


IRQ6 


STA 


ROMIN 


C861:2C 


16 


CO 


55 


IRQ7 


BIT 


RDALT2P 


C864:10 


OD 


C873 


56 




BPL 


IR08 


C866:BA 






57 




TSX 




C867:8E 


01 


Dl 


58 




STX 


S101 


C86A:AE 


00 


1 


59 




LDX 


$100 


C86D:9A 






60 




TXS 





;Pascal 1.0 Initialization 

;SAVE ACC ON STACK, NOT $45 

; LEGAL BECAUSE IF IRQ, IRQ DISABLED. 

;GET STATUS REGISTER 

; CLEAR DEC MODE, ELSE THINCS GET SCREWED, 
;SET CARRY TO INDICATE BRK 

;SAVE X IN A WHILE 

; FUTZ1NG WITH THE STACK 

; RECOVER A-REG AT TOP... 

;SAVE X ON STACK (ON TOP OF A) 
; AND Y ALSO 
;Get mouse Info 

;TEST FOR 80-STORE WITH 

; PAGE 2 TEXT. 

; MAKE IT ZERO OR $80 



;SET PAGE 2 RESET BIT. 

; BRANCH IF MAIN RAM READ 
;ELSE, SWITCH IT IN 
; AND RECORD THE EVENT! 
;D0 THE SAME FOR RAM WRITE. 



BRANCH IF BREAK, NOT INTERRUPT 

SAVE MACHINE STATES SO FAR... 

GO TEST THE MOUSE 

BRANCH IF IT WAS THE MOUSE 

GO TEST ACIA AND KEYBOARD INTERRUPTS 

BRANCH IF INTERRUPT SERVICED 

RESTORE STATES RECORDED SO FAR 

RESET BREAK/ INTERRUPT INDICATOR 

Skip around pascal 1.0 stuff 



;DETERMINE IF LANGUAGE CARD ACTIVE 

jSET TWO BITS SO RESTORED 
; LANGUAGE CARD IS WRITE ENABLED 
; BRANCH IF NOT PAGE 2 OF SD000 
; ENABLE READ FOR PAGE 2 ON EXIT 

; LAST... AND VERY IMPORTANT! 
; UNLESS IT IS NOT ENABLED 
;SAVE CURRENT STACK POINTER 
;AT BOTTOM OF STACK 
;GET MAIN STACK POINTER 






fc- 



158 



Appendix I: Firmware Listings 



"J 
I 



I 

i 
J 



L 
























1 — 


C86E 


8D 


08 


CO 


'■[ 




STA 


SETSTDZP 










C871 


09 


80 




62 




ORA 


#S80 








L — 


C873 


BO 


2 A 


C89F 


63 


IRQ8 


BCS 


COBREAK 










C875 


48 






64 




PHA 










r 


C876 
C878 


A9 

48 


C8 




65 

66 




LDA 
PHA 


<K IRQDONE 








■ 


C879 


A9 


82 




67 




LDA 


#> IRQDONE 


;SAVE RETURN IRQ ADDR 






C87B 


48 






68 




PHA 












C87C 


A9 


04 




69 




LDA 


.'-.'. 


; SO WHEN INTERRUPT DOES RTI 






1 


C87E 


48 






7m 




PHA 




; IT RETURNS TO IRQDONE. 






■ — 

■ — 


C87F 


6C 


PE 


03 


71 




JMP 


(S3FE) 


; PROCESS EXTERNAL INTERRUPT 






1 


C882 


68 






73 


IRQDONE 


PLA 




; RECOVER MACHINE STATE 






: 


C883 


10 


07 


C88C 


;., 




BPL 


IRQDNE1 


; BRANCH IF MAIN ZP WAS ACTIVE 






C885 


8D 


09 


CO 


M 




STA 


SRTALTZP 










C888 


AE 


01 


01 


76 




LDX 


sioi 


; RESTORE ALTERNATE STACK POINTER 






L , 


C88B 


9A 






7 7 




TXS 










i 


C88C 


OA 






78 


IRQDNE1 


ASL 


A 








C88D 


AO 


05 




79 




LDY 


#$05 










C88F 


BE 


89 


C9 


80 


IRQDNE2 


LDX 


IRQTBLE.Y 








L^ 


C892 


88 






81 




DEY 










i^ja 


C893 


OA 






82 




ASL 


A 








■ ^ 


C894 


90 


03 


C899 


83 




BCC 


IRQDNE3 


-.BRANCH IF SWITCH IS OK. 








C896 


9D 


00 


CO 


-■-. 




STA 


SCOOO.X 








L — . 


C899 


DO 


F4 


C88F 


85 


IRQDNF.3 


BNE 


IRQDNE2 


; BRANCH IF MORE SWITCHES 






■• -d 


C89B 


7 A 






86 




PLY 










t 


C89C 
C89D 
C89E 


FA 

68 
40 






87 
88 
89 




PLX 
PLA 
RTI 




;RESTORE ALL REGISTERS 
;DO THE REAL RTI! 






r 


C89F 


4C 


47 


FA 


90 


GO BREAK 


JMP 


NEWBRK 


;PASS THE BREAKER THROUGH 






L 


C8A2 








92 


******************** A ************ ******* 






1 


C8A2 








93 


* 














C8A2 








94 


* MOVEIRQ - This routine transfers the roms interrupt vector into 








C8A2 








95 


* both 


language cards 










C8A2 








96 


* 














C8A2 








97 


**************************************** 








C8A2 






C8A2 


98 


movelrq 


equ 


* 








*— - 


C8A2 


20 


60 


C3 


99 




JSR 


SETROM 


;Read ROM and Write to RAM 






C8A5 


AD 


16 


CO 


100 




LDA 


RDALTZP 


;WhIch language card? 








C8A8 


OA 






101 




ASL 


A 


;C-1 if alternate card 






I 


C8A9 


AO 


01 




102 




LDY 


#1 


;Move two bytes 






■ — 


C8AB 


B9 


FE 


FF 


103 


MIRQLP 


LDA 


IRQVECT.Y 


;Cet byte from ROM 






C8AE 


8D 


09 


CO 


104 




STA 


SETALTZP 


;Set alternate card 








C8B1 


99 


FE 


FF 


105 




STA 


IRQVECT.Y 


; Store it In the RAM card 






1 


C8B4 


8D 


08 


CO 


106 




STA 


SETSTDZP 


;Set main card 






S ^ 


C8B7 


99 


FE 


FF 


107 




STA 


IRQVECT.Y 








a 


C8BA 


88 






108 




DEY 












C8BB 


10 


BE 


C8AB 


109 




BPL 


MIRQLP 


;Co do the second byte 






■ 


C8BD 


90 


03 


C8C2 


110 




BCC 


MIRQSTD 


; Is the card set right? 






C8BF 


8D 


09 


CO 


111 




STA 


SETALTZP 


;No, it wasn't 






b 


CSC 2 


4C 


54 


C3 


112 


MIRQSTD 


JMP 


RESETLC 


; Clean up & go home 






r 














Appendix 1: Firmware Listings 


1159 





C8C5: 
CSC 5: 
C8C5: 
C8C5: 
C8C5: 
C8C5: 

C8C5:EC FF 
C8C8:DQ 26 
C8CA:A0 00 
C8CC: 

C8CC:B9 7F 
C8CF:D9 7F 
C8D2:F0 24 
C8D4:48 
C8D5:1A 
C8D6:89 7F 
C8D8:D0 01 
C8DA:98 
C8DB:99 7F 
C8DE:7A 
C8DF:AD 13 
C8E2:0A 
C8E3:8D 03 
C8E6;B9 00 



,■-. 



C8F0 

C8CC 

» 

C8F8 

C8DB 



C8E9:B0 14 C8FF 

C8EB:8D 02 

C8EE:38 

C8EF:60 

C8F0: 

C8F0:BC 85 

C8F3:B9 F9 

C8F6:29 08 

C8F8:18 

C8F9:F0 04 C8FF 

C8FB:B9 F8 BF 

C8FE:38 

C8FF: C8FF 

C8FF:60 



CO 



C8 



114 
115 
116 
117 
118 
119 
120 
121 
122 
123 
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 



This 
flag se 
valid. 

GETBUF- 
On ent 



* 
* 
* 
* 
XRDSER 



is Che serial input routine. Carry 
t Indicates that returned data Is 



GET BUT 



GBNOOVR 



* 
XNOSBUF 



CB EMPTY 



notacia 

acdone 

XRDSNO 



Gets 

ry Y-0 

CPX 

BNE 
LDY 
EQU 
LDA 
CMP 
BEO 
PHA 
INC 
BIT 
BNE 
TYA 
STA 
PLY 
LDA 
ASL 
STA 
LDA 
BCS 
STA 
SEC 
RTS 

LDY 
LDA 
AND 
CLC 
BEO 
LDA 
SEC 
equ 
RTS 



a byte from 
for Serial 
ACIABUF 

XNOSBUF 
#0 

k 

TRSER.Y 

TWSER.Y 
CBEMPTY 

A 

tfS7F 

GBNOOVR 

TRSER.Y 

RDRAMRD 

A 

RDCARDRAM 

THBUF.Y 

XRDSNO 

RDMAINRAM 



DBVNO.X 
SSTAT,Y 
#S8 

XRDSNO 

SDATA.Y 



the buffer & updates pointers 
buffer Y-S80 for Keyboard buffer 

;is serial input buffered? 

;(in engllsh "NO SERIAL BUFFER") 

;Y-0 for serial buffer 

;Test for data in buffer 
;If ■ then no data 

;Save current value 
;Update the pointer 
;Overf low 



;Store the updated pointer 

;Get the old value of the pointer 

;Are we in main ram 

;C=1 for Aux ram 

;Force Aux ram 

;Get byte from buffer 

; Branch i f we were in aux bank 

;Set back to main 

;Note C-l 

;Get index to ACIA 

;Test ACIA directly for data 

; indicate no data 

;Branch if no data! 

;get serial input 

;indlcate valid data returned. 






160 



Appendix I: Firmware Listings 



i 

l: 
l! 
l: 

■ 

E 

l: 
l 



L 
L 



C900i 

C900 

C900 

C900 

C900: 

C900: 

C900: 

C900: 

C900: 

C900 

C900: 

C900: 

C900: 

C900; 

C900: 

C900 

C900: 

C900: 

C900: 

C900: 

C900; 

C900: 
C900: 
C900: 
C900: 
C900 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 
C900: 

C900:A2 C2 
C902:20 08 
C905:90 F8 
C907:CA 
C908:8C 85 
C90B:A9 04 
C90D:59 FA 
C910:29 0C 
C912:F0 F.A 
C914:B9 F9 
C917:9D 38 
C91A:10 E2 
C91C:E0 C2 
C91E:B0 02 
C920:49 40 
C922:3C 38 
C925:70 26 
C927:10 22 
C929:90 20 
C92B:89 40 



.-,.. 



C8FF 



C8FE 

\ 
C8FE 

C922 



MS 



C94D 
C94B 
C94B 



153 

154 

155 

156 

157 

158 

159 

160 

161 

162 

163 

164 

165 

166 

167 

168 

169 

170 

171 

172 

173 

174 

175 

176 

177 

178 

179 

180 

181 

182 

183 

184 

185 

186 

187 

188 

189 

190 

191 

192 

193 

194 

195 aciatst 

196 

197 

198 

199 

200 

201 

202 

203 aitst2 

204 

205 

206 aiport2 

207 

208 

209 

210 



This routine will determine if the source of 
is either of the built in ACIAs. If neither port 
generated the interrupt, or the interrupt was due 
to a transmit buffer empty, protocol converter, or 
'unbuffered' receiver full, the carry is set indi- 
cating an externally serviced interrupt. 

If the interrupt source was keyboard, 'buffered* 
serial input, or the DCD, the interrupt is serviced 
and the carry is cleared indicating interrupt was 
serviced. (DCD handshake replaces CTS. ) 

Location "AC1ABUT" specifies which (if either) re- 
ceiver data is buffered. For port 1 it must contain 
SCI, for port 2 a SC2. Any other values are cause 
interrupts to pass to external (RAM based) routines. 

Location "TYPHED" specifies whether Keyboard in- 
put should be buffered, ignored, or processed by 
RAM based routines. If bit 7-1 and bit 6-0, key- 
board data Is placed in the type-ahead buffer. If 
bit 6 is set the interrupt is cleared, but must 
be recognized and serviced by a RAM routine. If 
both bits - 0, the interrupt is serviced, but the 
keyboard data is ignored. 

While using type-ahead, Open-Apple CTRL-X will 
flush the buffer. No other code is recognized. 

If the source was an ACIA that has the transmit 
interrupt enabled, the original value of the ACIAs 
status registers is preserved. Automatic serial input 
buffering is not serviced from a port so configured. 
Interrupts originating from the protocol converter or 
keyboard (RAM serviced) do not inhibit serial buffering 
and are passed thru. The RAM service routine can rec- 
ognize the interrupt source by a 1 state in bit 6 of 
the ACIAs status register. The RAM service routine must 
cause the clearing of DSR (bit 6) AND make a second ac- 
cess to the status register before returning. 



* 
* 

acialnt 



equ 
ldx 
jsr 
bcc 
dex 
ldy 
Ida 
eor 
and 
beq 
Ida 
sta 
bpl 
cpx 
bcs 
eor 
bit 
bvs 
bpl 
bcc 
bit 



#<coraslot 

aciatst 

acdone 

devno, x 

#$4 

scomd.y 

"$0C 

notacla 

sstat.y 

astat ,x 

notacla 

»<comslot 

aiport2 

#$40 

extint ,x 

a i pass 

aieatit 

aieatit 

#$40 



;Test port 2 first 
;Check for interrupt 
;Return if interrupt done 

;Try port 1 
;Get index for acla 
;If xmit ints enabled pass to user 
;Check if D<3>, D<2> - 01 

;User better take it! 
;Get status 
;Save it away 
;No interrupt 

;C=1 if com port 

; Invert DSR if port! 



;Is DSR enabled? 
;Yes, user wants it 
;No, eat it 
;Yes but I don't want 
;Is DSR 1? 



it for port 1 



Appendix I: Firmware Listings 



161 



C92D:F0 


IE 


C94D 


211 




beq 


alpass 


;If not, skip It 


C92F: 






212 


* It's a 


keyboard Interrupt 




C92F:AD 


00 


CO 


213 




Ida 


kbd 


;Get the key 


C932:A0 


BO 




214 




ldy 


#S80 




C934:20 


67 


C9 


215 




jsr 


putbuf 


;Put It In the buffer 


C937:C9 


98 




216 




cmp 


*S98 


;Is It a ~x? 


C939:DO 


08 


C943 


217 




bne 


alnof lsh 




C93B:AD 


62 


CO 


218 




Ida 


butnl 


;And the closed apple? 


C93E:10 


03 


C943 


219 




bpl 


alnof lsh 




C940:20 


IB 


CB 


220 




J« 


flush 


;Flush the buffer 


C943:AD 


10 


CO 


221 


alnof lsh 


Ida 


kbdstrb 


; Clear the keyboard 


C946: 






222 


* SAO SBO table needed by serial firmware 


C946: 




00C1 


223 


sit day 


equ 


<serslot 




C946: 




C885 


224 


devno 


equ 


*-sltdmy 




C946:A0 


BO 




225 




ldy 


flSBO 


; Restore y 


C948:B9 


F9 


BF 


226 




Ida 


sstat.y 


;Read status to clear Int 


C94B:29 


BF 




227 


aleatlt 


and 


flSBF 


;Clear the DSR bit 


C94D:0A 






228 


alpass 


asl 


A 


;Shlft DSR Into C 


C94E:0A 






229 




asl 


A 




C94F:29 


20 




230 




and 


#$20 


; Is the receiver full? 


C951:FO 


35 


C988 


231 




beq 


acladone 


;If not, we're done 


C953:B9 


FA 


BF 


232 




Ida 


scomd.y 


;Are receive Interrupts ena 


C956:49 


01 




233 




eor 


#1 


;Check for D<1>,D<0> - 01 


C958:29 


03 




234 




and 


#3 




C95A:D0 


2C 


C988 


235 




bne 


acladone 


;If not, were done 


C95C:8A 






236 




txa 




;Is this acta buffered? 


C95D:4D 


FF 


04 


237 




eor 


aclabuf 




C960:D0 


9C 


C8FE 


238 




bne 


notacla 


;The user better handle it! 


C962:B9 


F8 


BF 


239 




Ida 


sdata.y 


;It's mine 


C965:A0 


00 




240 




ldy 


BO 




C967: 




C967 


241 


putbuf 


equ 


* 




C967:DA 






242 




phx 






C968:48 






243 




pha 






C969:B9 


7F 


05 


244 




Ida 


twser ,y 


;Get buffer pointer 


C96C:AA 






245 




tax 




;Save It for later 


C96D:1A 






246 




inc 


A" 


; Bump It to next free byte 


C96E:89 


7F 




247 




bit 


#$7F 


;0verflow? 


C970:D0 


01 


C973 


248 




bne 


pbok 




C972:98 






249 




tya 




;Wrap pointer 


C973:08 






250 


pbok 


php 




;Save DSR status 


C974:D9 


7F 


06 


251 




cmp 


trser.y 


;Buffer full? 


C977:FO 


03 


C97C 


252 




beq 


pbfufl 




C979:99 


7F 


05 


253 




sta 


twser, y 


;Save the new pointer 


C97C:28 






254 


pbfull 


pip 






C97D:68 






255 




pi a 




;Get the data 


C97E:8D 


05 


CO 


256 




sta 


wrcardram 


; It goes to aux ram 


C981-.9D 


00 


08 


257 




sta 


thbuf ,x 




C9S4 : 8D 


04 


CO 


258 




sta 


wrmainram 




C987:FA 






259 




plx 






C988:60 






260 


acladone 


rts 






C989:83 


8B 


8B 


262 


IRQTBI.E 


DFB 


>LCBANK2,>LCBANK1,>LCBANK1 


C98C:05 


03 


55 


263 




DFB 


>WRCARDRAM, 


■>RDCARDRAM,TXTPAGE2 






162 



Appendix I: Firmware Listings 



J 

m 

: 
1 



L 
L 
H 

l: 
l: 
l: 

E 

l: 

I 



C98F: 
C98F: 
C98F: 
C98F: 
C98F: 
C98F: 
C98F: 
C98F: 
C98F: 

C98F:20 AD C9 
C992:10 14 C9A8 
C994:90 OA C9A0 
C996:5A 
C997:AO 80 
C999:20 CC C8 
C99C:7A 
C99D:09 00 
C99F:60 

C9A0:AD 00 CO 
C9A3:10 EA C98F 
C9A5:8D 10 CO 
C9A8:60 

C9A9: 0001 

C9AA:4C F6 CI 



C9AD:2C FA 05 

C9B0:10 10 

C9B2:38 

C9B3:08 

C9B4:48 

C9B5:AD FF 06 

C9B8:CD FF 05 

C9BB:F0 03 

C9BD:68 

C9BE:28 

C9BF:60 

C9C0: 

C9C0 : 68 

C9C1:28 

C9C2:2C 00 CO 

C9C5:18 

C9C6:60 

C9C7; 



C9C2 



C9C0 



266 * The 


follow 


Ing two routines are for reading key- 




267 * board 


and serial input from 


buffers or directly. 




268 * Type-ahead 


buffering only 


occurs for non auto- 




269 * repeat 


keypresses. When a 


key is pressed for 




270 * auto-repeat 


the buffer is first emptied, then the 




271 * repeated cha 


racters are ret 


iirned. 




272 * The 


minus 


flag is used to 


indicate if a keystroke 




273 * is being returned. 






274 * 










276 XRDKBD 


JSR 


XBITKBD 


; is keyboard input ready? 




277 


BPL 


XNOKEY 


; Branch if not* 




278 


BCC 


XRKBDl 


; Branch If direct KBD input. 




279 


PHY 




-.Save Y 




280 


LDY 


#$80 


;Y=$80 for keyboard buffer 




281 


JSR 


GETBUF 


;Get data from buffer 




282 


PLY 








283 


ORA 


#0 


;Set minus flag 




284 


RTS 








286 XRKBD1 


LDA 


KBD 


;test keyboard directly 




287 


BPL 


XRDKBD 


; loop If buffered since test. 




288 


STA 


KBDSTRB 


;Clear keyboard strobe. 




289 XNOKEY 


RTS 




;Minus flag Indicates valid character 




291 


ds 


$C9AA-*.$00 






292 


jmp 


pi write 


;Pascal 1.0 entry point 




294 XBITKBD 


BIT 


TYPHED 


;This routine replaces "BIT KBD" instrucs 




295 


BPL 


XBKB2 


; so as to function with type-ahead. 




296 


SEC 




;anticlpate data In buffer is ready 




297 


PHP 




;save carry and minus flags 




298 


PHA 




; preserve accumulator 




299 


LDA 


TRKEY 






300 


CMP 


TWKEY 


; is there data to be read? 




301 


BEO 


XBKBl 


; branch If type-ahead buffer empty 




302 


PLA 








303 


PLP 








304 


RTS 




-.Carry and minus flag already set. 




305 * 










306 XBKB1 


PLA 








307 


PLP 




; restore ACC and Status 




308 XBKB2 


BIT 


KBD 


;test KBD Directly 




309 


CLC 




;indlcate direct test 




310 


RTS 








26 


INCLUDE COMMAND 


;Serial firmware command processor 






Appendix 1: Firmware Listings 1 163 





C9C7: 

C9C7: 

C9C7:66 

C9C8:66 

C9C9:66 

C9CA:5C 

C9CB:5C 

C9CC:7C 

C9CD:78 

C9CE:77 

C9CF:C3 

C9D0:B4 

C9D1:98 

C9D2:C5 

C9D3:54 

C9DA : 7F 

C9D9:80 

C9DE: 

C9DE:A9 

C9E2:0D 

C9E3:A2 

C9EB:A8 

C9EC:3C 

C9EF:30 

C9FI:BC 

C9FA:F0 

C9F6:5D 

C9F9:0A 

C9FA:D0 

C9FC:AC 

C9FF:8C 

CA02:A0 

CA0A:8C 

CA07:80 

CA09:38 

CA0A:68 

CA0B:60 

CAOC: 

CAOC:BC 

CA0F:29 

CAM: DA 

CA12:A2 

CA1A:DD 

CA17:F0 

CA19:CA 

CA1A:10 

CA1C:FA 

CA1D:68 

CA1E:A8 

CAIF:29 

CA21:C9 

CA23:BO 

CA25:9D 

CA28:A9 

CA2A:C9 

CA2C:B0 

CA2E:AO 

CA30:6D 



C9C7 



BF BF 7F 
00 40 00 

C9DE 
AB AC AB 

AA 50 51 

B8 03 

1 B CAOC 
38 06 
13 CA09 
36 06 

OD CA09 

FB 07 

79 06 

BF 

FB 07 

2D CA36 



CAOC 
85 C8 
5F 

OC 

DE C9 

3A CAAD 



F8 



CA1A 



7F 

20 

03 CA2B 

38 06 

30 

OA 

OE 

OA 

7F OA 



CA3C 



3 

A cradtable 

5 

6 

7 

8 

9 

m 
11 

L2 
L3 
LA 
LS 
16 
17 

18 mask! 

19 mask2 

20 cmdllst 
21 

22 

23 

2A command 

25 

26 

27 

28 
29 

V) 

31 

32 

33 

34 

35 

36 

37 nocmd 

38 

39 

40 incmd 

41 

-'•: 

43 

AA 

A5 cmdloop 

A6 

48 
49 
50 
51 
52 

53 
5A 

55 cmdz2 

56 ckdig 
57 

58 
59 
60 dlgloop 



MSB 
equ 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
dfb 
equ 
asc 
dfb 
asc 
pha 
bit 
brai 
ldy 
beq 
eor 
asl 
bne 
ldy 
sty 
ldy 
sty 
bra 
sec 
pla 
rts 
equ 
ldy 
and 
phx 
Idx 
crap 
beq 
dex 
bpl 
plx 
pla 
pha 
and 
cmp 
bcs 
sta 
eor 
cmp 
bcs 
ldy 
adc 



OFF 

* 

>cmdi-l 

>cmdk-l 

>cmdl-l 

>cmdn-I 

>cmdcr-I 

>cmdb-l 

>cmdd-l 

>cmdp-l 

>cradq— 1 

>cradr-l 

>cmds-l 

>cmdt-l 

>cmdz-l 

S7F,SBF,SBF,S7F,SFF 

S8O,S00,S4O,SO0,$00 

* 

"1KLN" 

SOD 

"BDPQRSTZ" 



;CarrIage return 



sermode.x 

Incmd 

eschar ,x 

nocmd 

eschar, x 

A 

nocmd 

cursor 

oldcur 

flcmdcur 

cursor 

corainlt 



* 

devno.x 

«S5F 

#12 

cmdList ,x 
cmf ound 

cmdloop 



0$7F 

*S20 

ckdlg 

eschar ,x 

#$30 

#$0A 

cdone 

#10 

number 



; Check for command to firmware 
;Already in command? 
;If so, go do it 
;lf eschar ■ ignore commands 

;Is it the command char? 
; Ignore high bit 

;Save the cursor 

;Set command cursor 



;Mark char not handled 
;Restore char 

; Command mode 

;Get index for ACIA 

;Ignore hi bit: just upshift lowercase 

;Save slot 
;Check 13 commands 

; Right char? 



J 

& 



ft- 



;We didn't find it 



; if char is cntl char 

;it can be the new comd char 

;branch if not cntl character 

; Save comd char, drop thru ckdig to cdone 

; Is it a number? 

;If so, branch 

;A = A + 10 * current number 
;C=0 on first entry 



164 



Appendix I: Firmware Listings 



L 

l: 

■—J 

l: 

■ ,j 

■ J 

E 

■ 

l: 

i 
l 

L 



CA33:88 






61 




dey 




CA34:D0 


FA 


CA30 


62 




bne 


dlgloop 


CA36:8D 


7F 


04 


63 


cominlt 


sta 


number 


CA39:38 






64 




sec 




CA3A:80 


7 


CA43 


65 




bra 


craset 


CA3C:18 






66 


cdone 


clc 




CA3D:AD 


79 


06 


67 




Ida 


oldcur 


CA40:8D 


FB 


07 


68 




sta 


cursor 


CA43:08 






69 


onset 


php 




CA44 : IE 


B8 


03 


70 




asl 


sermode.x 


CA47:28 






71 




pip 




CA48:7E 


B8 


03 


72 




ror 


sermode,x 


CA4B:68 






73 




pla 




CA4C:60 






74 




rts 




CA4D:A9 


CA 




76 


cm found 


Ida 


(Kcmdcr 


CA4F:48 






77 




pha 




CA50:BD 


C7 


C9 


78 




Ida 


cmdtable ,x 


CA53:48 






79 




pha 




CA54:60 






BQ 




rts 




CA55:FA 






82 


cmdz 


plx 




CA56:9E 


B8 


04 


83 




stz 


pwdth.x 


CA59:A9 


00 




84 




Ida 


#0 


CASB:80 


C8 


CA25 


85 




bra 


cradz 2 


CA5D: 




CA5D 


87 


cmdcr 


equ 


* 


CA5D: 




CA5D 


88 


cmdn 


equ 


* 


CA5D:7A 






89 




ply 




CA5E:AD 


7F 


04 


90 




Ida 


number 


CA61:F0 


05 


CA68 


91 




beq 


cmdi 2 


CA63:99 


B8 


04 


92 




sta 


pwdth.y 


CA66:F0 






93 




dfb 


SF0 


CA67: 




CA67 


94 


cmdi 


equ 


* 


CA67: 




CA67 


95 


cmdk 


equ 


* 


CA67: 




CA67 


96 


cmdl 


equ 


* 


CA67:7A 






97 




ply 




CA68 : B9 


B8 


06 


98 


cmdi 2 


Ida 


flags.y 


CA6B:3D 


DA 


C9 


99 




and 


maskl ,x 


CA6E:1D 


D9 


C9 


100 




ora 


mask2,x 


CA71:99 


BB 


06 


101 




sta 


flags.y 


CA74:98 






102 




tya 




CA75:AA 






103 




tax 




CA76:80 


C4 


CA3C 


104 


cdone2 


bra 


cdone 


CA78:88 






106 


cmdp 


dey 




CA79:A9 


IF 




107 


cmdd 


Ida 


tfSIF 


CA7B:38 






108 




sec 




CA7C:90 






109 




dfb 


S90 


CA7D:A9 


ro 




110 


cmdb 


Ida 


ffSFO 


CA7F:18 






111 




clc 




CA80:39 


FB 


BI 


112 




and 


scntl.y 



;Mark in command mode 

;0ut of command mode 
;Restore the cursor 



;set command mode according to carry 

; leaves carry clear 
; character handled 
-.because carry clear... 



;do JMP via RTS 



;Go to it 



;Zero escape character 
;And the width 



;Get number inputted 

; Don't change printer width if 

;Update printer width 

;BEQ opcode to skip next byte 



;Mask off bit we'll change 
; Change it 
;Back it goes 
;Put slot back in x 



;Good bye 



;Make y point to command reg 
;Mask off high three bits 

;C-1 means high 3 bits 
;BCC opcode to skip next byte 
;Mask off lower 4 bits F0 - BNE 

;F0 will skip thia if cmdp or cmdd 
;Mask off bits being changed 



Appendix I: Firmware Listings 



165 



CA83:8D F8 Oft 
CA86:FA 
CA87:AD 7F 04 
CA8A:29 OF 
CA8C:90 05 
CA8E:0A 
CA8F:0A 
CA90:0A 
CA91:0A 
CA92:OA 
CA93:OD F8 06 
CA96:C8 
CA97:80 17 



CA93 



CAS'"" 1 



113 


eta 


temp 


1 1A 


plx 




115 


Ida 


number 


116 


and 


ff$0F 


117 


bcc 


noshlft 


118 


asl 


A 


119 


asl 


A 


120 


asl 


A 


121 


asl 


A 


122 


asl 


A 


123 noshlft 


ora 


temp 


124 


tny 




125 


bra 


crodp2 



;Save It 

;Get inputed number 

;Only lower nibble valid 

;lf C-l shift to upper 3 bits 



;Get the rest of the bits 

;Put them in the ACIA 

;increment puts em away where they go, 



J 



CA99:B9 


FA 


BF 


127 


crads 


Ida 


scomd.y 


;Transrait a break 


CA9C:48 






128 




pha 




;Save current ACIA state 


CA9D:09 


DC 




129 




ora 


#S0C 


;Do the braek 


CA9F:99 


FA 


BF 


130 




sta 


scomd.y 




CAA2:A9 


S9 




131 




Ida 


0233 


;For 233 ms 


CAA4:A2 


53 




132 


mswalt 


Idx 


#83 


;Wait I ns 


CAA6.-48 






133 


msloop 


pha 




;((12*82)+U)+2+3-1000us 


CAA7:68 






134 




pla 






CAA8:CA 






135 




dex 






CAA9-.D0 


PB 


CAA6 


136 




bne 


msloop 




CAAB:3A 






137 




dec 


a 




CAAC-.DO 


F6 


CAA4 


138 




bne 


mswait 




CAAE:68 






139 




pla 






CAAF:FA 






140 




Plx 






CAB0:99 


FA 


BF 


141 


cmdp2 


sta 


scomd.y 




CAB3:80 


CI 


CA76 


142 




bra 


cdone2 





^ 

U4 






CAB5:99 


F9 


BF 


144 


cmdr 


sta 


sstat , v 


CABS : AD 


7B 


06 


145 




Ida 


vfactv 


CABB:0A 






146 




asl 


A 


CABC:20 


23 


CE 


147 




jar 


sethooks 


CABF:90 


03 


CAC4 


148 




bcc 


cmdq 


CAC1:20 


4D 


CE 


149 




jsr 


zzqui t 


CAC4:18 






150 


cmdq 


clc 




CAC5:B0 






151 




dfb 


SBO 


CAC6:38 






152 


cmdt 


sec 




CAC7:FA 






153 




plx 




CAC8:20 


CD 


CA 


154 




jsr 


setterm 


CACB:80 


A : ' 


CA76 


155 




bra 


cdone2 


CACD:BD 


B8 


03 


156 


set term 


Ida 


serraode.x 


CAD0:89 


^! 




157 




bit 


ff$40 


CAD2:90 


12 


CAE6 


158 




bcc 


stclr 


CAD4 : DO 


20 


CAF6 


159 




bne 


stwasok 


CAD6:E4 


39 




160 




cpx 


kswh 


CAD8:D0 


47 


CB21 


161 




bne 


strts 


CADA:09 


Am 




162 




ora 


0S4O 


CADC:AC 


79 


06 


163 




ldy 


oldcur 


CADF:8C 


7A 


06 


164 




sty 


oldcur2 


CAE2:A0 


DP 




165 




ldy 


fltermcur 


CAE4 : 80 


07 


CAED 


166 




bra 


stset 



; Reset the ACIA 

;Check if video firmware active 

;Save it in C 

; assume video firmware active 

;branch if good guesser... 

; Reset the hooks 

;Quit terminal mode 
;BCS to skip next byte 

;Into terminal mode 

;Recover X 



;Get terminal mode status 
;Z=1 if not In terminal mode 
;Branch if clearing terminal 
;Was already set 
;Are we in the input hooks 
;Leaves C=l if ■ 
;Set term mode bit 
;Save what was in oldcur 

;Cet new cursor value 



node 



L^ 



1661 



Appendix I: Firmware Listings 



L 

L: 
l: 

■ 4 

l: 

■ ^ 

i 

t 

i 

L 



CAE6:F0 


OE 


CAF6 


167 


CAE8:29 


BF 




168 


CAEA:AC 


7A 


06 


169 


CAED:9D 


B8 


03 


170 


CAFO : 8C 


79 


06 


171 


CAF3:BC 


FB 


07 


172 


CAF6:BC 


85 


C8 


173 


CAF9:58 






174 


CAFA:08 






175 


CAFB:78 






176 


CAFC:B9 


FA 


hr 


177 


CAFF: 09 


02 




178 


CB01:90 


02 


CB05 


179 


CB03:29 


FD 




180 


CB05:99 


FA 


BF 


181 


CB08:A9 


00 




182 


CB0A:6A 






183 


CB0B:8D 


PA 


05 


184 


CB0E:10 


07 


CB17 


185 


CB10:9C 


7F 


05 


186 


CB13:9C 


7F 


06 


187 


CB16:8A 






188 


CBL7:8D 


FF 


k'. 


189 


CB1A:28 






190 


CB1B:8E 


PF 


05 


191 


CB1E:8E 


FF 


06 


192 


CB21:60 






193 


CB22: 




0002 


194 


CB24:E8 






195 


CB25:4C 


FB 


C7 


196 


CB28:9E 


DB 


40 50 


197 


CB30: 






27 



stclr beq stwasok 

and #$BF 

ldy oldcur2 

stset eta serraode.x 

sty oldcur 

sty cursor 

stwasok ldy devno.x 

cli 

php 

sel 

Ida scomd.y 

ora ff$2 

bcc cmdt2 

and flSFD 

cmdt2 sta scomd.y 

Ida #0 

ror a 

sea typhed 

bpl cmdt3 

stz twser 

stz trser 

txa 

cmdt3 sea aciabuf 

pip 

flush stx twkey 

stx trkey 
strts rts 

ds $CB24-*,$00 
zznm2 inx 

jmp zznml 

comtbl dfb S9E, $0B, $40, $50, $16, SOB, SOI, $00 

INCLUDE SCROLLING ;More Video stuff @$CB30 



;Branch If already clear 
;Clear the bit 
;Restore the cursor 

; Save cursor to be restored after command 



;want to leave with Interrupts active 

;but off while we twlttle bits 

jdisable receiver Interrupts if 
; not In terminal mode 
;enable when In terminal mode 

;set kbd interrupts according to t-mode 

;branch If leaving terminal mode 
; and ser buf . . . 

;use x to enable serial buffering 

;restore carry, enable interrupts. 
;Flush the type ahead buffer 



Appendix I: Firmware Listings 



167 



CB30: 
CB30: 
CB30: 
CB30: 
CB30: 
CB30: 
CB30: 
CB31: 
CB33; 
CB35: 
CB35: 
CB36: 
CB38: 
CB3A: 
CB3D: 
CB3F: 
CB42: 
CB43: 
CB44: 
CB45: 
CB47: 
CB48: 
CB49: 
CB4B: 
CB4E; 
CB4F: 
CB51: 
CB52: 
CB54: 
CB56: 
CB57: 
CB5A: 
CB5D: 
CB5E: 
CB60: 
CB62: 
CB64: 
CB66; 
CB67: 
CB67: 
CB6A: 
CB6D: 
CB6D: 
CB6F: 
CB71: 
CB73: 
CB75: 
CB7 5: 
CB78: 
CB7A: 
CB7C: 
CB7Ei 
CB80: 
CB81: 
CB83i 
CB84 i 
CB86: 
CB8S; 



DA 

A2 00 
80 03 

DA 

A2 01 
A4 21 
2C IF 
10 18 
8D 01 
98 
4A 
A8 

A5 20 
4A 
B8 

90 03 
2C C! 
2A 

45 21 
4A 

70 03 
BO 01 
88 

8C F8 
AD IF 
08 

A5 22 
EO 00 
DO 03 
A5 23 
3A 

8D 78 
20 24 

A5 28 

85 2A 

A5 29 

85 2B 

AD 78 
EO 00 
DO 07 
:C5 22 
;F0 39 
3A 

:80 05 
:1A 

;C5 23 
:B0 31 



CB3fl 



CO 



CB57 



CO 



CB4E 



CB 



CB57 
CB57 



05 

CO 



CB67 



05 
PC 



05 



CB83 
CBB9 
CB88 

CBB9 



168 



SCROLLI 

on the 
or odd 

windows 



3 

4 
5 
6 
7 

8 * 

9 SCROLLDN 
10 

11 

12 * 

13 SCROLLUP 
14 

15 SCROLLI T 

16 

17 

LB 

:■- 

2:: 

21 

22 

23 

24 

25 

26 

27 CHKRT 

28 

29 

30 

31 

32 

33 GETST 

34 

35 

36 
37 
38 

J9 
40 

41 * 

42 SETDBAS 
43 

44 * 

45 SCRLIN 
46 

47 

48 

49 * 

50 

51 

52 

53 

54 

r >5 

56 
57 
58 
59 

60 



T scrolls the screen either up or down, depending 
value of X. It scrolls within windows with even 
edges for both 40 and 80 columns. It can scroll 
down to 1 characters wide. 



a. 



PHX 

LDX "0 

BRA SCROLL IT 



SETUP 2 



PHX 
LDX 
LDV 
BIT 
BPL 
STA 
TYA 
LSR 
TAY 
LDA 
LSR 
CLV 
BCC 
BIT 
ROL 
EOR 
LSR 
BVS 
BCS 
DEY 
STY 
LDA 
PHP 
LDA 
CPX 
BNE 
LDA 
DEC 

STA 
JSR 

LDA 
STA 
LDA 
STA 

LDA 
CPX 
BNE 
CMP 
BEQ 
DEC 
BRA 
INC 
CMP 
BCS 



#1 

WNDWDTH 

RD80VID 

GETST 

SET80COL 



WNDLFT 
A 

CHKRT 

SEV1 

A 

WNDWDTH 

A 

GETST 

GETST 

TEMPY 
RD80VID 

WNDTOP 

HO 

SETDBAS 

WNDBTM 

A 

TEMPA 

VTABZ 

BASL 

BAS2L 

BASH 

BAS2H 

TEMPA 

*0 

SETUP2 

WNDTOP 

SCRL3 

A 

SETSRC 

A 

WNDBTM 

SCRL3 



save X 

direction - down 
do scroll 

save X 

direction » up 

get width of screen window 

In 40 or 80 columns? 

->40, determine starting line 

make sure this is enabled 

get WNDWDTH for test 

divide by 2 for 80 column Index 

and save 

test oddity of right edge 

by rotating low bit into carry 

V-0 If left edge even 

->check right edge 

V=l If left edge odd 

restore WNDLFT 

get oddity of right edge 

C-l if right edge even 

if odd left, don't DEY 

if even right, don't DEY 

if right edge odd, need one less 

save window width 

N-l If 80 columns 

save N.Z.V 

assume scroll from top 

up or down? 

»>up 

down, start scrolling at bottom 

really need one less 

save current line 

calculate base with window width 

;current line Is destination 



;get current line 

; going up? 

=>up, inc current line 

;down. Reached top yet? 

;yes! clear top line, exit 

;no, go up a line 

;set source for scroll 

;up, inc current line 

;at bottom yet? 

;yes! clear bottom line, exit 






i* 



Appendix I: Firmware Listings 



J 



t 

L 

■- .1 

l 

l: 

E 



CB88:8D 


78 


05 


M 


SETSRC 


STA 


TEMPA 


CB8B:20 


24 


FC 


hi 




JSR 


VTABZ 


CB8E:AC 


F8 


05 


63 




LDY 


TEMPY 


CB9I:28 






64 




PLP 




CB92:08 






65 




PHP 




CB93:10 


IF 


CBB4 


66 




BPL 


SKPRT 


CB95:AD 


55 


CO 


67 




LDA 


TXTPAGE2 


CB98:98 






68 




TYA 




CB99:F0 


07 


CBA2 


69 




BEQ 


SCRLFT 


CB9B:B1 


28 




70 


SCRLEVF.N 


LDA 


(BASL).Y 


CB9D:91 


2A 




71 




STA 


(BAS2D.Y 


CB9F:88 






72 




DEY 




CBA0:DO 


F9 


CB9B 


73 




BNE 


SCRLEVEN 


CBA2:70 


Q4 


CBA8 


74 


SCRLFT 


BVS 


SKPLFT 


CBA4:B1 


28 




75 




LDA 


(BASL).Y 


CBA6:91 


2A 




76 




STA 


(BAS2D.Y 


C8A8:AD 


54 


CO 


77 


SKPLFT 


LDA 


TXTPAGE1 


CBAB:AC 


F8 


05 


78 




LDY 


TEMPY 


CBAE:BO 


04 


CBB4 


78 




BCS 


SKPRT 


CBBO:Bl 


28 




HO 


SCRLODD 


LDA 


(BASL).Y 


CBB2:91 


2A 




81 




STA 


(BAS2L),Y 


CBB4:88 






B2 


SKPRT 


DEY 




CBB5:10 


P9 


CBBO 


83 




BPL 


SCRLODD 


CBB7:80 


B4 


CB6D 


94 




BRA 


SCRLIN 


CBB9: 






85 


* 






CBB9:20 


AO 


FC 


86 


SCRL3 


JSR 


CLRLIN 


CBBC:20 


11 


FC 


87 




JSR 


VTAB 


CBBF:28 






8 8 




PLP 




CBCO : FA 






89 




PLX 




CBC1:60 






90 


SEV1 


RTS 





;save new current line 

;get base for new current line 

;get width for scroll 

;get status for scroll 

;N-1 if 80 columns 

;=>only do 40 columns 

;scroll aux page first (even bytes) 

;test Y 

;if Y=0, only scroll one byte 



;do all but last even byte 
;odd left edge, skip this byte 



;now do main page (odd bytes) 

; restore width 

;even right edge, skip this byte 



;scroll next line 

;clear current line 

-.restore original cursor line 

;pull status off stack 

; restore X 

;doneII ! 



Appendix I: Firmware Listings 



169 



CBC2: 




92 


* 








CBC2: 




93 


* DOCLR 


Is call 


ed by CLREOL. 


It decides whether 


CBC2: 




94 


* to do 


a (quic 


k) 40 oc 80 cc 


ilumn clear to end of line. 


CBC2: 




95 


* 








CBC2:2C IF 


CO 


96 


DOCLR 


BIT 


RD80VID 


;40 or 80 column clear? 


CBC5:30 13 


CBDA 


97 




BH1 


CLR80 


;->clear 80 columns 


CBC7:9l 28 




98 


CLR40 


STA 


(BASL).Y 




CBC9:C8 




99 




INY 






CBCA:C4 21 




100 




CPY 


WNDWDTH 




CBCC:90 F9 


CBC7 


101 




BCC 


CLR40 




CBCE:60 




102 




RTS 






CBCF: 




103 


* 








CBCFrDA 




104 


CLRHALF 


PHX 




;clear right half of screen 


CBD0:A2 D8 




105 




LDX 


0SD8 


;for SCRN48 


CBD2:A0 14 




106 




LDV 


#20 




CBD4:A5 32 




107 




LDA 


INVFLC 




CBD6:29 AO 




108 




AND 


#SAO 




CBD8:80 17 


CBF1 


109 




BRA 


CLR2 


;->jump Into middle 


CBDA: 




110 


* 








CBDA:DA 




HI 


CLRBO 


PHX 




; preserve X 


CBDB:48 




112 




PHA 




;and blank 


CBDC:98 




113 




TYA 




;get count for CH 


CBDD:48 




114 




PHA 




;save for left edge check 


CBDE:38 




115 




SEC 




;count-WNDWDTH-Y-l 


CBDF:E5 21 




116 




SBC 


WNDWDTH 




CBE1:AA 




117 




TAX 




;save CH counter 


CBE2:98 




118 




TYA 




;dlv CH by 2 for half pages 


CBE3:4A 




119 




LSR 


A 




CBE4:A8 




120 




TAY 






CBE5:68 




121 




PLA 




;restore original CH 


CBE6:45 20 




122 




EOR 


WNDLFT 


;get starting page 


CBE8:6A 




123 




ROR 


A 




CBE9:B0 03 


CBEE 


124 




BCS 


CLRO 




CBEB:10 01 


CBEE 


125 




BPL 


CLRO 




CBE0:C8 




126 




TNY 




;lff WNDLFT odd, starting b 


CBEE:68 




127 


CLRO 


PLA 




;get blankity blank 


CBEF:BO OB 


CBFC 


128 




BCS 


CLR1 


;starting page Is 1 (defaul 


CBF!:2C 55 


CO 


129 


CLR2 


BIT 


TXTPAGE2 


;else do page 2 


CBF4:91 28 




130 




STA 


(BASL).V 




CBF6:2C 54 


CO 


131 




BIT 


TXT PACE 1 


;now do page 1 


CBF9:E8 




132 




INX 






CBFA:F0 06 


CC02 


133 




BEQ 


CLR3 


;all done 


CBFC:91 28 




134 


CLR1 


STA 


(BASL).Y 




CBFE:C8 




135 




1NY 




;forward 2 columns 


CBFF:E8 




136 




INX 




;next CH 


CC00:D0 EF 


CBF1 


137 




BNF. 


CLR2 


;not done yet 


CC02:FA 




138 


CLR3 


PLX 




•.restore X 


CC03:60 




139 




RTS 




;and exit 


CC04: 




140 


* 








CC04:9C FA 


05 


141 


CLRPORT 


STZ 


TYPHED 


;disable typeahead 


CC07:9C F9 


05 


142 




STZ 


EXT INT 2 


;and external interrupts 


CCOA: 60 




143 




RTS 










^ 



I— 






J 



170 



Appendix I: Firmware Listings 



L 


















1 - 


CCOB: 






1A5 


* 










CCOB: 






1A6 


* PASINVERT is 


used by Pascal to display the cursor. Pascal 


u — 

■—J 


CCOB: 






147 


* normally leaves the cursor 


on the screen at all times. It 


CCOB: 






1A8 


* is fleetingl> 


removed while a character Is displayed, then 




CCOB: 






1A9 


* promptLy redi 


splayed. CTL 


-F and CTL-E, respectively. 




CCOB: 






150 


* disable and enable display 


of the cursor when printed using 


■ — 


CCOB: 






151 


* the Pascal 1. 


1 entry point 


(PWRITE). Screen I/O is 


CCOB: 






152 


* significantly 


faster when 


the cursor is disabled. This 




CCOB: 






153 


* feature is supported by Pascal 1.2 and later. 


L_ 


CCOB: 






15A 


* 








■ — 


CCOB: AD 


FB 


04 


155 


PASINVERT LDA 


VMODE 


;Called by pascal to 


CCOE:29 


IC 




156 




AND 


0M. CURSOR 


;display cursor 




CC10:DO 


OA 


CC1C 


157 




BNE 


INVX 


;=>cursor off, don't invert 


L 


CC12: 




CC12 


158 


INVERT 


EQU 


* 




■ -^ 


CC12:20 


ID 


CC 


159 




JSR 


PICKY 


; load Y and get char 


CC15:A8 






160 




PHA 








CC16:49 


BO 




161 




EOR 


0$8O 


;FLIP INVERSE/ NORMAL 


1 . 


CC18:20 


b a 


C3 


162 




JSR 


STORY 


;stuff onto screen 


P 


CC1B:68 
CC1C:60 
CCID: 






163 
16A 
165 


INVX 

* 


PLA 
RTS 




;for RDCHAR 


L_ 


CCID: 






166 


* PICK lifts a 


character from the screen in either 


■_j 


CCID: 






167 


* AO or 


80 columns from the current cursor position. 


1^ 


CCID: 






168 


* If the alternate character 


set is switched in, 




CCID: 






169 


* character codes S0-S1F are 


returned as SAO-S5F (which 


L— 


CCID: 






170 


* is what must 


have been originally printed to the location). 


J-* 


CCID: 






171 


* 








CC1D:5A 






172 


PICKY 


PHY 




; save Y 




CC1E:20 


9D 


CC 


173 




JSR 


GETCUR 


;get newest cursor into Y 


r-i 


CC21:AD 


IF 


CO 


17A 




LDA 


RD80VID 


;80 columns? 


■-d 


CC2A:10 


17 


CC3D 


175 




BPL 


PICK1 


;->no 


|^ 


CC26:8D 


01 


CO 


176 




STA 


SET80COL 


; force 80STORE if 80 columns 




CC29:98 






177 




TYA 






t^i 


CC2A:45 


20 




178 




EOR 


WNDLFT 


;C-1 if char in main RAM 


! • 


CC2C : 6A 






179 




ROR 


A 


;get low bit Into carry 




CC2D:BO 


D4 


CC33 


180 




BCS 


PICK2 


;->store in main memory 


1 


CC2F:AD 


5^ 


CO 


181 




LDA 


TXTPAGE2 


;else switch in page 2 


?"-3 


CC32:C8 






182 




I NY 




; f or odd left, aux bytes 


! 


CC33:98 






183 


PICK2 


TYA 




;divide pos'n by 2 




CC3A:AA 






18A 




LSR 


A 




I 


CC35:A8 






185 




TAY 




;and use as offset into line 


■15 


CC36:BI 


28 




186 




LDA 


(BASL),Y 


;plck character 


■ 


CC38:8D 


5A 


CO 


187 




STA 


TXTPAGE1 


;80 columns, switch in 




CC3B:80 


02 


CC3F 


188 




BRA 


PICK3 


;skip A0 column pick 


1 


CC3D:B1 


28 




189 


PICK1 


LDA 


(BASL).Y 


;pick A0 column char 


■ 


CC3F:2C 


LB 


CO 


190 


PICK3 


BIT 


ALTCHARSET 


;only allow if alt set 


CCA2:10 


oe 


CCAA 


191 




BPL 


PICKA 






CCAA:C9 


20 




192 




CMP 


#$20 




■ 


CCA6:B0 


02 


CCAA 


193 




BCS 


PICKA 




■ "5 


CCA8:09 


:,U 




19A 




ORA 


0$AO 




| 


CCAA:7A 
CCAB:60 






195 
196 


PICK A 


PLY 
RTS 




;restore real Y 


h 


CCAC: 
CCAC: 






197 
198 


* 

* SHOWCUR displays either a 


checkerboard cursor, a solid 


CCAC: 






199 


* rectangle, or the current 


cursor character, depending 




CCAC: 






200 


* on the value 


of the CURSOR 


location. 0-Inverse cursor, 


■ ^ 


CCAC: 






201 


* SFF=checkecboard cursor, anything else is displayed 


c 


CCAC: 






202 


* after 


being anded with inverse mask. 


r 












Appendix 1: Firmware Listings 1171 



B 



CC4C: 

CC4C:AC FB 
CC4F:D0 02 
CCS 1:80 BF 
CC53: 
CC53: 
CC53: 

CC53:20 ID 
CC56:48 
CC57:8D 7B 
CC5A:98 
CC5B:C8 
CC5C:F0 0D 
CC5E : 7 A 
CCSF:5A 
CC60:30 09 
CC62:AD IE 
CC65:09 7F 
CC67:4A 
CC68:2D FB 
CC6B:20 B3 
CC6E:68 
CC6F:60 
CC70: 
CC70: 
CC70: 
CC70: 
CC70: 
CC70: 
CC70: 
CC70: 
CC70: 
CC70:4S 
CC71:E6 4E 
CC73:D0 1C 
CC75:A5 4F 
CC77:E6 4F 
CC79:45 4F 
CC7B:29 10 
CC7D:F0 12 
CC7F:AD FB 
CC82:F0 OD 
CC84:20 ID 
CC87:AC 7B 
CC8A:8D 7B 
CC8D:98 
CC8E:20 B3 
CC91:68 
CC92:20 AD 
CC95:10 28 
CC97:20 83 
CC9A:4C 8F 
CC9D: 
CC9D: 
CC9D: 
CC9D: 
CC9D: 
CC9D: 



07 



CC53 
CC12 



CC6B 



CC6B 



co 



CC91 



CC91 



07 

i 
CG 

07 
07 

C3 

C9 

C3 

eg 



CC91 



CCBF 



203 
20A 
20S 
206 
207 
208 
209 
210 
211 
212 
213 
21A 
215 
216 
217 
218 
219 
220 
221 
222 
223 
22A 
225 
226 
227 
228 
229 
230 
231 
232 
233 
23A 
235 
236 
237 
238 
239 
240 
2A1 
242 
243 
244 
245 
2A6 
2A7 
248 
2A9 
250 
251 
252 
253 
254 
255 
256 
257 
258 
259 
260 



SHOWCUR LDY CURSOR ;what's my type? 
BNE NOTINV ;->not Inverse 
BRA INVERT ;else Invert the char (exit) 



* Exit with char In accumulator 



NOTINV JSR 
PHA 
STA 
TYA 
I NY 
BEQ 
PLY 
PHY 
BMI 
LDA 
ORA 
LSR 
NOTINV 1 AND 
N0TINV2 JSR 
PLA 
RTS 



PICKY 



NXTCUR 



NOTINV 2 



N0TINV2 

ALTCHARSET 

#S7F 

A 

CURSOR 

STORY 



;get char on screen 

;preserve It 

;save for update 

;test for checkerboard 

;->checkerboard, display it 
;test char 

;don't need inverse 
;mask - S7F if alternate 
; character set, 
;S3F if normal char set 
; f orm char to display 
;and display it 
;restore real char 



* 
* 
* 
* 
* 

* 

* NOTE: this routine used by COMM firmware!! 

* 



The UPDATE routine increments the random seed. 
If a certain value is reached and we are in Apple II 
mode, the blinking check cursor is updated. If a 
key has been pressed, the old char is replaced on the 
screen, and we return with BMI. 



UPDATE 



UD2 



CLRKB0 



PHA 
INC 
BNE 
LDA 
INC 
EOR 
AND 
BEQ 
LDA 
BEQ 
JSR 
LDY 
STA 
TYA 
JSR 
PLA 
JSR 
BPL 
JSR 
JMP 



RNDL 

UD2 

RNDH 

RNDH 

RNDH 

#$10 

UD2 

CURSOR 

UD2 

PICKY 

NXTCUR 

NXTCUR 

STORY 

XBITKBD 
CETCURX 
STORY 
XRDKBD 



;save char 

;update seed 
;check for key 



;need to update cursor? 
;-)no, check for key 
;what cursor are we using? 
;->//e cursor, leave alone 
;get the character into A 
;get next character 
;save next next character 

;and print it 

;get real char 

;was a key pressed? 

;->no key pressed 

;restore old key 

;look for keystroke and exit 



* ON CURSORS. Whenever the horizontal cursor position is 

* needed, a call to GETCUR is done. This is the equivalent 

* of a LDY CH. This returns the current cursor for II and 

* lie mode, which may have been poked as either CH or OURCH, 






— 

Ma 



— 



172 



Appendix I: Firmware Listings 



L= 














I" 


CC9D: 

CC9D: 




261 
262 


* It also forces CH and OLDCH to if 80 column mode active. 

* This prevents LDY CH, STA (BASL),Y from trashing non screen 






1— 


CC9D: 
CC9D: 




263 

264 


* memory. Tt works Just like the //e. 

* 






LI 


CC9D: 
CC9D: 




265 

266 


* All routines that update the cursor's horizontal position 

* are here. This ensures that the newest value of the cursor 






1 i 

■ — - 


CC9D: 
CC9D: 
CC9D: 
CC9D: 




267 
268 
269 
270 


* is always used, and that 80 column CH is always 0. 

* 

* GETCUR only affects the Y register 

* 






■' 


CC9D:A4 


24 


271 


GETCUR LDY CH ;if CH-OLDCH, then 






■ — 


CC9F:CC 


7B 04 


272 


CPY OLDCH ;0URCH 1b valid 








CCA2:D0 


03 CCA7 


273 


BNE GETCUR1 ;->else CH must have been changed 






L 


CCA4:AC 


7B 05 


274 


LDY OURCH ;use OURCH 








CCA7:C4 


21 


275 


GETCUR1 CPY WNDWDTH ;is the value too big 






■ — 


CCA9:90 


02 CCAD 


276 


BCC GETCUR2 ;->no f fits just fine 








CCAB:AO 


00 


277 


LDY #0 ;else force CH to 






■ — 


CCAD: 
CCAD: 




278 
279 


* 

* GETCUR2 is commonly used to set the current cursor 






CCAD: 




280 


* position when Y can be used. 








CCAD: 




281 


* 








CCAD:8C 


7B 05 


282 


CETCUR2 STY OURCH jupdate real cursor 






CCB0.-2C 


IF CO 


283 


BIT RD80VID ;80 columns? 






i^ 3 


CCB3:10 


02 CCB7 


284 


BPL GETCUR3 ;->no, set all cursors 








CCB5:A0 


00 


285 


LDY #0 ;yes, peg CH to 






L 


CCB7:84 


24 


286 


GETCUR3 STY CH 






I ^ 


CCB9:8C 


7B 04 


287 


STY OLDCH 






|~ 


CCBC:AC 
CCBF:60 


7B 05 


288 
289 


LDY OURCH ;get cursor 
GETCURX RTS ; and fly... 






■ 

1^ 


CCCO: 




28 


INCLUDE ESCAPE 






L 














i 














E 














l: 

■ j 














L 














1 - 














h 














h 








Appendix 1: Firmware Listings 


1173 





CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCCO: 
CCC3: 
CCC4: 
CCC7: 
CCC8: 
CCCA: 
CCCC: 
CCCC: 
CCCC: 
CCCC: 
CCCC: 
CCCC: 
CCCC: 
CCCC: 
CCCC: 
CCCF: 
CCDO: 
CCD2: 
CCD4: 
CCD7: 
CCDA: 
CCDC: 
CCDD : 
CCEO: 
CCE3: 
CCE5: 
CCE8: 
CCEA: 
CCEB: 
CCED: 
CCED: 
CCED: 
CCED: 
CCED: 
CCED: 
CCEF: 
CCF2: 
CCF5: 
CCF8: 



B9 OC 
5A 

20 58 
7A 

CO 08 
BO 21 



CD 

CD 



CCED 



20 ID 
48 

29 80 
49 AB 
20 B3 
20 AD 
10 FB 
68 

20 97 
20 9B 
AO 13 
D9 F8 
FO D6 
88 
10 F8 



CC 



CCD7 



CC 
C3 

CC 



CCCO 
CCE5 



A9 08 
1C FB 
20 OC 

4C 44 



-'- 

VI) 

PD 



2 
3 
4 
5 

- 
7 

6 

9 
LO 
11 

12 * 

13 * 
14 
15 
L6 

;. ; 

LB 
19 

20 * 

21 ESC3 
22 
23 
24 

26 

27 

28 

29 

30 

3 J 

12 

33 

34 

35 NEWESC 

36 

3/ 

"38 

39 

40 ESCO 

41 

42 

43 

44 

45 ESC1 

46 ESC2 
47 
48 
49 
50 
51 
52 
SI 
54 

55 ESCRDKEY 
56 

S7 
58 
59 * 



START AN ESCAPE SEQUENCE: 
WE HANDLE THE FOLLOWING ONES: 

@ - HOME & CLEAR 

A - Cursor right 

B - Cursor left 

C — Cursor down 

D - Cursor up 

E - CLR TO EOL 

F - CLR TO EOS 

I, Up Arrow - CURSOR UP (stay escape) 

J, Lft Arrow - CURSOR LEFT (stay escape) 

K, Rt Arrow - CURSOR RIGHT (stay escape) 

M, Dn Arrow - CURSOR DOWN (stay escape) 

4 - GOTO 40 COLUMN MODE 

8 - GOTO 80 COLUMN MODE 
CTL-D- Disable the printing of control chars 
CTL-E- Enable the printing of control chars 
CTL-Q- QUIT (PR0O/INCO) 



LDA ESCCHAR.Y ;GET CHAR TO "PRINT" 

PHY ;save index 

JSR CTLCHAR -.execute character 

PLY ; restore index 

CPY #YHI ;If Y<YHI, stay escape 

BCS ESCRDKEY ;->exit escape mode 



Thla Is the entry point called by RDKEY iff escapes 
are enabled and an escape is encountered. The next 
keypress is read and processed. If it is a key that 
terminates escape mode, a new key is read by ESCRDKEY, 
If escape mode should not be terminated, NEWESC is 
called again. 



JSR PICKY ;get current character 

PHA ;and save it 

AND #S80 ;save invert bit 

EOR ffSAB ;make it inverted "+" 

JSR STORY ;and pop it on the screen 

JSR XBITKBD ;check for keystroke 

BPL ESCO 

PLA ;get old char 

JSR CLRKBD ; restore char, get key 

JSR UPSHIFT ;upehift esc char 

LDY ffESCNUM ;COUNT/INDEX 

CMP ESCTAB.Y ; IS IT A VALID ESCAPE? 

BEO ESC3 =>yes 

DEY 

BPL ESC2 ;TRY 'EM ALL... 



End of escape sequence, read next character. 

This is initially called by RDCHAR which is usually called 

by GETLN to read characters with escapes enabled. 



LDA 
TRB 
JSR 
J MP 



ffM.CTL 
VMODE 
RDKEY 
NOESCAPE 



;enable escape sequences 

;read char with escapes 

;got the key, disable escapes 



g: 

ft? 



174 



Appendix I: Firmware Listings 



! 

i 

! 

■ 

I 

E 



CCF8: 


Bfl 


CCF8: 


61 


CCF8: 


Uj. 


CCF8: 


63 


CCF8: 


64 


CCF8: 


fig 


CCF8: 


66 


CCF8: 


«7 


CCF8: 


6fl 


CCF8: 


&g 


CCF8: 


7:; 


CCF8: 


71 


CCF8: 


Tl 


CCF8: 


73 


CCF8: 


CCF8 74 


CCF8:CA 


75 


CCF9:88 


76 


CCFA:CD 


11 


CCFB:8B 


7H 


CCFC:95 


79 


CCFD:8A 


BO 


CCFE:C9 


81 


CCFF:CB 


82 


CDOO: 


0008 83 


CD00:C2 


84 


CD01:C3 


85 


CD02.-C4 


86 


CD03:C1 


87 


CD04:CD 


88 


CD05:C5 


89 


CD06:C6 


90 


CD07:B4 


91 


CD08:B8 


92 


CD09:91 


93 


CD0A:84 


94 


CDOB:85 


95 


CDOC: 


96 


CDOC: 


0013 97 


CDOC: 


98 


CDOC: 


CDOC 99 


CDOC: 88 


100 


CD0D:88 


101 


CD0E:8A 


102 


CDOF:9F 


103 


CD10:9C 


104 


CDll:8A 


105 


CD12:9F 


106 


CD13:9C 


107 


CD14:88 


108 


CD15: 


CD15 109 


CD15:8A 


110 


CD16:9F 


111 


CD17:9C 


112 


CD18:8C 


113 


CD19:9D 


114 


CD1A:8B 


115 


CD1B:91 


116 


CD1C:92 


117 



When in escape mode, Che characters in ESCTAB (high) 
bits set), are mapped into the characters in ESCCHAR. 
These characters are then executed by a call to CTLCHAR. 

CTLCHAR looks up a character in the table starting at 
CTLTAB. It uses the current index as an index into the 
table of routine addresses, CTLADR. If the character is 
not In the table, a call to VIDOUT1 is done In case the 
character Is BS, LF, CR, or BEL- 
NOTE: CTLON and CTLOFF are not accessible except through 
and escape sequence 



ESCTAB 



YHI 



MSB 
E0U 
ASC 
DFB 
ASC 
DFB 
DFB 
DFB 
ASC 
ASC 
EQU 
ASC 
ASC 
ASC 
ASC 
ASC 
ASC 
ASC 
ASC 
ASC 
DFB 
DFB 
DFB 



* 

ESCNUM 

* 

ESCCHAR 



CTLTAB 



EQU 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
EQU 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 



OH 

* 

•J* 

S88 

'M* 

S8B 

S95 

S8A 

'I' 

•K' 

*-ESCTAB 

•B' 

•C 

*D' 

•A' 

t@. 

'E' 
rpi 

•4' 
•8' 
$91 
$84 
$85 



EQU *-ESCTAB-l 



$88 
$88 
$8A 
$9F 
$9C 
$8A 
$9F 
$9C 
$88 
* 

$8A 
$9F 
$9C 
$8C 
$9D 
$8B 
$91 
$92 



;hlgh bit on 

;left (stay esc) 
;left arrow (stay esc) 
;down (stay esc) 
;up arrow (stay esc) 
;right arrow (stay esc) 
;down arrow (stay esc) 
;up (stay esc) 
;right (stay esc) 

;left 
;dowo 

;up 

; right 

; formfeed 

; clear EOL 

; clear EOS 

;40 column mode 

;80 column mode 

;CTL-Q = QUIT 

;CTL-D ;ctl char disable 

;CTL-E ;ctl char enable 



list of escape chars 

J: BS (stay esc) 

<-:BS (stay esc) 

M: LF (stay esc) 

UP:US (stay esc) 

->:FS (stay esc) 

DN: LP (stay esc) 

l: UP (stay eBc) 

K: RT (stay esc) 

ESC-B - BS 

list of control characters 

ESC-C - DN 

ESC-D = UP 

ESC-A - RT 

(?: Formfeed 

E: CLREOL 

F: CLREOP 

SET40 

SET80 



Appendix I: Firmware Listings 



175 



CD1D:95 

CD1E:0A 

CD1F:05 

CD20: 

CD20:85 

CD21 :86 

CD22:8E 

CD23:8F 

CD2A:96 

CD25:97 

CD26:98 

CD27:99 

CD28:9A 

CD29:9B 

CD2A: 

CD2A: 

CD2A: 

CD2A: 

CD2A:66 

CD2C:1A 

CD2E:AO 

CD30:58 

CD32:9C 

CD3A:A2 

CD36:CO 

CD38:BE 

CD3A:45 

CD3C:91 

CD3E:95 

CD40:89 

CDA2:8D 

CDAA:BO 

CDA6:B7 

CDA8:30 

CDAA:35 

CDAC:9F 

CDA£:A5 

CD50:AO 

CD52:99 

CD5A: 

CD5A: 

CD5A: 

CD5A: 

CD5A: 

CD5A: 

CD5A: 

CD5A: 

CD5A: 

CD54: 

CD5A: 

CD5A: 

CD5A: 

CD5A:2C 

CD57 : 50 

CD 58: 

CD58:B8 

CD59:DA 

CD5A;8D 



FC 
PC 
FB 
FC 
FC 
PC 
en 
CD 
CE 
CD 
CD 
CD 
CD 

CI) 
CD 
CB 
C.H 
CD 
CD 
FC 
CD 



001A 



CD2A 



DFB $95 

DFB $0A 

DFB $05 

escape chars end here 

DFB $85 

DFB $86 

DFB $8E 

DFB $8F 

DFB $96 

DFB $97 

DFB $98 

DFB $99 

DFB $9A 

DFB $9B 



CI CB 



F8 OA 



118 
119 

120 
121 
122 
123 
12A 
125 
126 
127 
128 
129 
130 
131 

132 * 

133 CTLNUH 
13A * 

135 CTLADR 
136 
137 
138 
139 
1A0 
1AI 
1A2 
1A3 
1AA 
145 
1A6 
1A7 
1A8 
1A9 
150 
151 
152 
153 
15A 
155 
156 
157 * 
158 

159 * 

160 * 

161 * 

162 * 

163 * 
16A * 

165 * 

166 * Note: This routine is only called if the video firmware 

167 * is active. The Monitor ROM calls VIDOUTl if the video 

168 * firmware is inactive. 

169 * 

;set V (use M.CTL) 
;BVC opcode (never taken) 

-.Always do control character 

;save X 

; temp save of A 



EQU 

EQU 

DW 

DW 

DW 

DM 

DW 

DW 

DW 

DW 

DU 

DW 
DW 
DW 
M 
DW 
DW 
DW 
DW 
DW 
DW 
DW 

DU 
MSB 



*-CTLTAB-l 

* 

LF 

UP 

NEWADV 

HOME 

CLREOL 

CLREOP 

SP.TA0 

SET80 

QUIT 

CTLOFF 

CTLON 

X. CUR. ON 

X. CUR. OFF 

X.SO 

X.SI 

SCROLLDN 

SCROLLUP 

MOUSOFF 

HOMECUR 

CLRLIN 

MOUSON 

ON 



;QUIT 

;Disable controls (escape only) 

;F.nable controls (escape only) 

;X.CUR.ON 
;X. CUR. OFF 
;Normal 
; Inverse 
;Scroll down 
;Scroll up 
;mouse chars off 
; home cursor 
;clear line 
;mouse chars on 



;tnove cursor down 
;move cursor up 
; forward a space 
;home cursor, clear screen 
;clear to end of line 
;clear to end of page 
;set AO column mode 
;set 80 column mode 
;Quit video firmware 
;disable //e control chars 
;enable lie control chars 
;turn on cursor (pascal) 
;turn off cursor (pascal) 
;normal video 
•.inverse video 
;scroll down a line 
;scroll up a line 
;disable mouse characters 
;move cursor home 
; clear current line 
;enable mouse characters 



CTLCHAR executes the control character in the 
accumulator. If It is called by Pascal, the character 
is always executed. If it is called by the video 
firmware, the character is executed if M.CTL is set 
and M.CTL2 is clear. 






170 CTLCHAR0 


BIT 


SEV1 


171 


DFB 


$50 


L72 * 






173 CTLCHAR 


CLV 




17A 


PHX 




175 


STA 


TEMP 



176 



Appendix I: Firmware Listings 



t 



§ 



CD5D:20 04 


FC 


176 


JSR 


V1DOUT1 


;try to execute CR, LF, BS f 


or BEL 


CD60:CD F8 


04 


177 


CMP 


TEMPI 


;if ace has changed 




CD63:DO 0A 


CD6F 


178 


BNE 


CTLDONE 


; then function done 




CD65:A2 14 




179 


LDX 


tfCTLNUM 


; number of CTL chars 




CD67:DD 15 


CD 


180 FNDCTL 


CMP 


CTLTAB.X 


;ls It in table 




CD6A:F0 05 


CD71 


181 


BEQ 


CTLGO 


; - >yes, should we execute? 




CD6C:CA 




182 


DEX 




;else check next 




CD6D:10 FB 


CD67 


183 


BPL 


FNDCTL 


;=>try next one 




CD6F:FA 




184 CTLDONE 


PLX 




; restore X 




CD70:60 




185 


RTS 




;and return 




CD71: 




186 * 










CD71:48 




187 CTLGO 


PHA 




; save A 




CD72:50 OC 


CD80 


188 


BVC 


CTLGO 1 


;V clear, always do (pascal 


escape 


CD74:AD FB 


04 


189 


LDA 


VMODE 


jcontrols are enabled iff 




CD77:29 28 




190 


AND 


0M.CTL+M.CTL2 ; M.CTL ■ 1 and 




CD79:49 08 




191 


EOR 


0M.CTL 


; M.CTL2 - 




CD7B:F0 03 


CD80 


192 


BEQ 


CTLGO 1 


;->they're enabled! 1 




CD7D:68 




193 CGO 


PLA 




;restore A 




CD7E:FA 




194 


PLX 




; restore X 




CD7F:60 




195 


RTS 




;and return 




CD80: 




196 * 










CD80:8A 




197 CTLC01 


TXA 




;double X as index 




CD81:0A 




198 


ASL 


A 


;into address table 




CD82:AA 




199 


TAX 








CD83:68 




200 


PLA 




; restore A 




CD84:20 A4 


PC 


201 


JSR 


CTLDO 


;execute the char 




CD87:FA 




202 


PLX 




; restore X 




CD88:60 




203 


RTS 




;and return 




CD89: 




204 * 










CD89: 




205 * X.CUR. 


ON ■ Allow Pascal cursor display 




CD89: 




206 * X.CUR. 


OFF - Disable Pascal 


cursor display 




CD89: 




207 * Cursor 


is not displayed dur 


ing call, so it will 




CD89: 




208 * be right when "redisplayed 1 


. 




CD89: 




209 * Note: 


Though 


these commands 


are executed from BASIC, 




CD89: 




210 * they have no 


effect on firmware operation. 




CD89: 




211 * 










CD89:A9 10 




212 X.CUR. ON 


LDA 


CM. CURSOR 


;clear cursor bit 




CD8B:80 OE 


CD9B 


213 


BRA 


CLRIT 






CD8D: 




214 * 










CD8D:A9 10 




215 X.CUR. OFF LDA 


<M. CURSOR 


;set cursor bit 




CD8F:80 10 


CDA1 


216 


BRA 


SETIT 






CD91: 




217 * 










CD91: 




218 * The control characters other than CR,LF,BEL,BS 




CD9I: 




219 * are normally 


enabled when v 


ldeo firmware is active. 




CD91: 




220 * They can be disabled and enabled using the ESC-D 




CD9I: 




221 * and ESC-E escape sequences. 






CD91: 




222 * 










CD91:A9 20 




223 CTLOFF 


LDA 


#M.CTL2 


;dlsable control characters 




CD93:80 OC 


CDA1 


224 


BRA 


SETIT 


;by setting M.CTL2 




CD95: 




225 * 










CD95:A9 20 




226 CTLON 


LDA 


*M.CTL2 


;enable control characters 




CD97:80 02 


CD9B 


227 


BRA 


CLRIT 


;by clearing M.CTL2 




CD99: 




228 * 










CD99: 




229 * Enable 


mouse 


text by clearing M. MOUSE 




CD99r 




230 * 










CD99:A9 01 




231 MOUSON 


LDA 


#M. MOUSE 






CD9B:1C FB 


34 


232 CLRIT 


TRB 


VMODE 






CD9E:60 




233 


RTS 









Appendix I: Firmware Listings 



177 



CD9F: 




234 * 








CD9F: 




235 * Disable 


mouse 


text by setting M. MOUSE 


CD9F: 




236 * 








CD9F:A9 


01 


237 HOUSOFF 


LDA 


#M. MOUSE 




CDA1:0C 


FB 04 


238 SETIT 


TSB 


VMODE 




CDA4 : 60 




239 


RTS 






CDA5: 




240 * 








CDA5: 




241 * EXECUTE 


HOME: 






CDA5: 




242 * 








CDA5 : 20 


E9 FE 


24 3 HOMECUR 


JSR 


CLRCH 


;move cursors to far left 


CDA8:A8 




244 


TAY 




; (probably not needed) 


CDA9:A5 


22 


245 


LDA 


WNDTOP 


;and to top of window 


CDAB:85 


25 


246 


STA 


CV 




CDAD : 4C 


88 FC 


247 


JMP 


NEWVTABZ 


;then set base address, OURCV 


CDBO: 




248 * 








CDBO: 




249 * EXECUTE 


"NORMAL VIDEO" 




CDBO: 




250 * 








CDBO: 20 


84 FE 


251 X.SO 


JSR 


SETNORM 


;set 1NVFLG to $FF 


CDB3:A9 


04 


252 


LDA 


9H. VMODE 


;then clear Inverse mode bit 


CDB5:80 


E4 CD9B 


253 


BRA 


CLRIT 




CDB7: 




254 * 








CDB7: 




255 * EXECUTE 


"INVERSE VIDEO" 




CDB7: 




256 * 








CDB7:20 


80 FE 


257 X.S1 


JSR 


SETINV 


;set INVTLG to $3F 


CDBA:A9 


04 


258 


LDA 


#M. VMODE 


;then set inverse mode bit 


CDBC:80 


E3 CDA1 


259 


BRA 


SETIT 




CDBE: 




260 * 








CDBE: 




261 * EXECUTE 


•40COL MODE' or 


•80COL MODE" : 


CDBE: 




262 * 








CDBE: 38 




263 SET80 


SEC 




;flag an 80 column window 


CDBF:90 




264 


DFB 


S90 


;BCC opcode (never taken) 


CDC0:18 




265 SET40 


CLC 




;flag a 40 column window 


CDC1:2C 


FB 04 


266 


BIT 


VMODE 


;but...ls it pascal? 


CDC4: 10 


54 CE1A 


267 


BPL 


SETX 


;->yes, don't execute 


CDC6:08 




268 


PHP 




;save window size 


CDC7 : 20 


IB CE 


269 


JSR 


HOOKITUP 


;C0PYR0M If needed, set I/O hooks 


CDCA:28 




270 


PLP 




;and gee 40/80 


CDCB:80 


08 CDD5 


271 


BRA 


WINO 


;->set window 


CDCD: 




272 * 








CDCD: 




273 * CHK80 1 


s called by PRffO 


to convert to 40 If it was 


CDCD: 




274 * 80. Otfr 


erwlse the window Is left ajar. 


CDCD: 




275 * 








CDCD:2C 


IF CO 


276 CHK80 


BIT 


RD80VID 


;don't set 40 If 


CDDO:10 


48 CE1A 


277 


BPL 


SETX 


;already 40 


CDD2: 




278 * 








CDD2:18 




279 WIN40 


CLC 




;flag 40 column window 


CDD3:B0 




280 


DFB 


SBO 


;BCS opcode (never taken) 


CDDA : 38 




281 WIN80 


SEC 




; flag 80 column window 


CDD5:64 


22 


282 UINO 


STZ 


WNDTOP 


;set window top now 


CDD7 : 2C 


1A CO 


283 


BIT 


RDTEXT 


; for text or mixed 


CDDA: 30 


04 CDEO 


284 


BMI 


WIN1 


;->text 


CDDC:A9 


14 


285 


LDA 


#20 




CDDE : 85 


22 


286 


STA 


WNDTOP 


;used by 80<->40 conversion 


CDE0:2C 


IF CO 


287 WIN1 


BIT 


RD80VID 


;80 columns now? 


CDE3:08 




288 


PHP 




;save 80 or 40 


CDE4:B0 


07 CDED 


289 


BCS 


WIN2 


;»>80: convert If 40 


CDE6:10 


OA CDF2 


290 


BPL 


WIN3 


;«>40: no convert 


CDE8:20 


53 CE 


291 


JSR 


SCRN84 


;80: convert to 40 



3 



i 



& 

^ 



i 



2 



"j 



178 



Appendix I: Firmware Listings 



_j 



L 














■ ~ 


CDEB:80 05 


CDF2 


292 


BRA 


WIN3 


;done converting 




CDED:30 03 


CDF2 


293 WIN2 


BMI 


WIN3 


;->80: no convert 


m 


CDEF:20 80 


CE 


294 


JSR 


SCRN48 


;40: convert to 80 


J ■■* 


CDF2:20 9D 


CC 


295 UIN3 


JSR 


GETCUR 


;determine absolute CH 




CDF5:98 




296 


TYA 




;in case the window setting 


L 


CDF6:18 




297 


CLC 




;was different 




CDF7:65 20 




298 


ADC 


WNDLFT 




■ — ' 


CDF9:28 




299 


PLP 




;pln to right edge if 




CDFA:B0 06 


CE02 


300 


BCS 


WIN4 


;80 to 40 leaves cursor 


■L 


CDFC:C9 28 




301 


CMP 


#40 


;off the screen 


■— « 


CDFE:90 02 


CE02 


302 


BCC 


WIN4 




CE00:A9 27 




303 


LDA 


#39 






CE02:20 EC 


FE 


304 WIN4 


JSR 


SETCUR 


;set new cursor 


L 


CE05:A5 25 




305 


LDA 


cv 


;set new base address 


; 


CE07:20 Cl 
CEOA: 


FB 


306 
307 * 


JSR 


BASCALC 


;for left - (always) 




CE0A:6A 20 




308 WNDREST 


STZ 


WNDLFT 


;Called by INIT and Pascal 


1- 


CE0C:A9 18 




309 


LDA 


#$18 


;and bottom 


■Z3 


CE0E:85 23 




310 


STA 


WNDBTM 




■ 


CE10:A9 28 




311 


LDA 


#$28 


;set left, width, bottom 




CE12:2C IF 


CO 


312 


BIT 


RD80VID 


;set width to 80 If 80 columns 


L_ 


CE15:10 01 


CE18 


313 


BPL 


WIN5 




■ T1 

■ ^ 


CE17:0A 




314 


ASL 


A 




CE18:85 21 




315 WIN5 


STA 


WNDWDTH 


;set width 




CE1A:60 




316 SETX 


RTS 




;exit used by SET40/80 


■ 


CE1B: 




317 * 








■ri 


CE1B: 




318 * Turn on video firmware: 




■ 


CE1B: 




319 * 










CE1B: 




320 * This routine 


Is used by BASIC Init, ESC-4 , ESC-8 


■— - 


CE1B: 




321 * It copl 


es the Monitor ROM 


to the language card 


5"^» 


CEIB: 




322 * If necessary 


It sets the 


Input and output hooks to 




CE1B: 




323 * SC30x; 


It sets all switches for video firmware operation 




CEIB: 




324 * 








K^j 


CE1B:2C 7B 


06 


325 HOOKITUP 


BIT 


VFACTV 


; don't touch hooks 




CE1E:10 11 


CE31 


326 


BPL 


VIDMODE 


;if video firmware already active 


1 


CE20:20 38 


C3 


327 HOOKUP 


JSR 


COPYROM 


;Copy ROM to LC? 




CE23:A9 05 




328 SETHOOKS 


LDA 


#>C3KEYIN 


;set up SC300 hoolcs 


■ 


CE25:85 38 




329 


STA 


KSWL 




S^"^5 


CE27:A9 07 




330 


LDA 


#>c3coirri 






CE29:85 36 




331 


STA 


CSWL 




L 


CE2B:A9 C3 




332 


LDA 


#<C3C0UT1 




■— k 


CE2D:85 39 




333 


STA 


KSWH 




CE2F:85 37 




334 


STA 


CSWH 






CE31: 




335 * 








1 


CE31: 




336 * Now set 


the video firmware 


active 




CE31: 




337 * 








■ 


CE3l:9C FB 


07 


338 VIDMODE 


STZ 


CURSOR 


;set a solid Inverse cursor 




CE34:A9 08 




339 


LDA 


#M.CTL 


; preserve M.CTL bit 


1 


CE36:2D FB 


04 


340 


AND 


VMODE 




h 


CE39:09 81 




341 


ORA 


#M.PASCAL+M. 


MOUSE ;no pascal, mouse 


* 


CE3B: 




342 * 










CE3B: 




343 * Pascal 


calls 


here to set its mode 




CE3B: 




344 * 








CE3B:8D FB 


14 


345 PVMODE 


STA 


VMODE 


;set mode bits 


- 


CE3E:9C 7B 


M 


346 


STZ 


VFACTV 


;say video firmware active 




CE41:8D OF 


CO 


347 


STA 


SETALTCHAR 


;and set alternate char set 


!^ 


CE44:60 




348 QX 


RTS 






-u-£ 


CE45: 




349 * 









h 






Appendix I; Firmware Listings 



179 



CE45: 350 * QUIT converts che screen from 80 to 40 If necessary, 

CE45: 351 * sets a 40 column window, and restores the normal I/O 

CE45: 352 * hooks (COUTI and KEYIN). — — 

CE45: 353 * fc— * 

CE45:2C FB 04 354 QUIT BIT VMODE ;no quitting from paacal 

CE48:10 FA CE44 355 BPL QX 

CE4A:20 D2 CD 356 JSR WIN40 ; first, do an escape 4 

CE4D:20 89 FE 357 Z2QUIT JSR SETKBD ;do a IN#0 (used by COMM) 

CE50:4C 93 FE 358 JMP SETVID ;and a PR#0 






1801 Appendix I: Firmware Listings 



d 

a 

i 

j 



L 

l: 
L: 

l: 
i 

■ 

l: 

I 

i 

i 

■ 



CE53: 




360 


* 






CE53: 




361 


* SCRN84 


and SCRN48 conv 


CE53: 




362 


* WNDTOP 


must 


be set up 


CE53: 




363 


* be done. All register 


CE53: 




364 


* 






CE53:A2 17 




365 


SCRN84 


LDX 


#23 


CE55:8D 01 


CO 


366 




STA 


SET80COL 


CE58:8A 




367 


SCR1 


TXA 




CE59:20 CI 


FB 


368 




JSR 


BASCALC 


CE5C:A0 27 




369 




LDY 


#39 


CE5E:5A 




370 


SCR2 


PHY 




CE5F:98 




371 




TYA 




CE60:4A 




372 




LSR 


A 


CE61:B0 03 


CE66 


373 




BCS 


SCR3 


CE63:2C 55 


CO 


374 




BIT 


TXTPACE2 


CE66:A8 




375 


SCR3 


TAY 




CE67:B1 28 




376 




LDA 


(BASL),Y 


CE69:2C 54 


CO 


377 




BIT 


TXTPAGE1 


CE6C:7A 




378 




PLY 




CE6D:91 28 




379 




STA 


(BASL),Y 


CE6F:88 




380 




DEY 




CE70:10 EC 


CE5E 


381 




BPL 


SCR2 


CE72:CA 




382 




DEX 




CE73:30 04 


CE79 


383 




BHI 


SCR4 


CE75:E4 22 




384 




CPX 


WNDTOP 


CE77:BO DF 


CE58 


385 




BCS 


SCR1 


CE79:8D 00 


CO 


386 


SCR4 


STA 


CLR80C0L 


CE7C:8D 0C 


CO 


387 




STA 


CLRBOVID 


CE7F:60 




388 




RTS 




CE80: 




389 


* 






CE80:A2 17 




390 


SCRN48 


LDX 


#23 


CE82:8A 




391 


SCR5 


TXA 




CE83:20 CI 


PB 


392 




JSR 


BASCALC 


CE86:A0 00 




393 




LDY 


#0 


CH88:8D 01 


CO 


394 




STA 


SET80COL 


CE8B:B1 28 




395 


SCR6 


LDA 


(BASL).Y 


CE8D:5A 




396 


SCR8 


PHY 




CE8E:48 




397 




PHA 




CE8F:98 




398 




TYA 




CE90:4A 




399 




LSR 


A 


CE91:B0 03 


CE96 


400 




BCS 


SCR7 


CE93:8D 55 


CO 


401 




STA 


TXTPACE2 


CE96:A8 




402 


SCR7 


TAY 




CE97:68 




403 




PLA 




CE98:91 28 




404 




STA 


(BASL).Y 


CE9A:8D 54 


CO 


405 




STA 


TXT PAGE 1 


CE9D:7A 




406 




PLY 




CE9E:C8 




407 




INY 




CE9F:C0 28 




408 




CPY 


#40 


CEA1:90 E8 


CE8B 


409 




BCC 


SCR6 


CEA3:20 CF 


CB 


410 




JSR 


CLRHALF 


CEA6:CA 




411 




DEX 




CEA7:30 04 


CEAD 


412 




BHI 


SCR9 


CEA9:E4 22 




413 




CPX 


WNDTOP 


CEAB:BO D5 


CE82 


414 




BCS 


SCR5 


CEAD:8D OD 


CO 


415 


SCR9 


STA 


SET80VID 


CEB0:60 




416 




RTS 




CF.B1: 




29 




INCLUDE PASCAL 



;start at bottom of screen 
; allow page 2 access 
;calc base for line 

;start at right of screen 

;save 40 Index 

;div by 2 for 80 column index 



;even column, do page 2 
;get 80 Index 
;get 80 char 
;restore pagel 
;get 40 Index 



;do next 40 byte 
;do next line 
;™>done with setup 
;at top yet? 

; clear 80STORE for 40 columns 
;clear 80VID for 40 columns 



;start at bottom of screen 
;set base for current line 

;start at left of screen 

;enable page2 store 

;get 40 column char 

;save 40 column index 

;save char 

;dlv 2 for 80 column index 

;save on pagel 

;get 80 column Index 
;now save character 

;flip pagel 

;restore 40 column Index 

;move to the right 

;at right yet? 

;«>no, do next column 

;clear half of screen 

;else do next line of scree 

;«>done with top line 

;at top yet? 

; convert to 80 columns 

;Pascal support stuff 



Appendix I: Firmware Listings 



181 



CEB1:AA 






3 


P STATUS 


TAX 




CEB2:F0 


08 


CEBC 


4 




BEQ 


PIORDY 


CEB4:CA 






5 




DEX 




CEB5:D0 


07 


CEBE 


6 




BNE 


PSTERR 


CEB7:20 


AD 


C9 


7 




JSR 


XBITKBD 


CEBA: 10 


04 


CECO 


8 




BPL 


PNOTRDY 


CEBC:38 






9 


PIORDY 


SEC 




CEBD:60 






10 




RTS 




CEBE:A2 


03 




11 


PSTERR 


LDX 


#3 


CEC0:18 






12 


PNOTRDY 


CLC 




CEC1:60 






13 




RTS 




CEC2: 






14 


* 






CEC2: 






15 


* PASCAL 


OUTPUT 


: 


CEC2: 






16 


* 






CEC2: 




CEC2 


17 


PWRITE 


EQU 


* 


CEC2:09 


BO 




18 




ORA 


#S80 


CEC4:AA 






19 




TAX 




CEC5:20 


54 


CF 


20 




JSR 


PSETUP2 


CEC8:A9 


08 




21 




LDA 


ffK.COXY 


CECA:2C 


FB 


04 


22 




BIT 


VMODE 


CECD:DO 


2B 


CEFA 


23 




BNE 


GETX 


CECF:8A 






24 




TXA 




CED0:89 


60 




25 




BIT 


#$60 


CED2:F0 


45 


CF19 


26 




BEQ 


PCTL 


CED4 : AC 


7B 


05 


27 




LDY 


OURCH 


CED7:24 


32 




28 




BIT 


INVFLC 


CED9 : 30 


2 


CEDD 


29 




BHI 


PUR1 


CEDB:29 


7F 




30 




AND 


#$7F 


CEDD:20 


CI 


C3 


31 


PWR1 


JSR 


STORE 


CEE0:C8 






32 




INY 





;ls request code = 0? 

;->yes, ready for output 

; check for any Input 

;->bad request, return error 

;test keyboard 

;»>no keystroked 

;good return 

;else flag error 



turn on high bit 

save character 

SETUP ZP STUFF, don't set ROM 

ARE WE DOING GOTOXY? 

=>Dolng X or Y? 

now check for control char 

Is It control? 

■>yes, do control 

get horizontal position 

check for Inverse 

normal, go store It 

now store It (erasing cursor) 

INC CH 



d 



182 



Appendix I: Firmware Listings 



j 

j 



j 



L 

E 

l: 



E 



CEE1:8C 7B 05 


33 




STY 


OURCH 




CEE4:C4 21 


34 




CPY 


WNDWDTH 




CEE6:90 0C CEFA 


35 




BCC 


PWRET 




CEE8:20 60 C3 


36 




JSR 


SETROM 




CEEB:20 E9 FE 


37 




JSR 


CLRCH 


;eet cursor position 


CEEE:20 66 FC 


38 




JSR 


LP 




CEF1:20 54 C3 


39 


PWRITERET JSR 


RESETLC 




CEF4:20 OB CC 


40 


PWRET 


JSR 


PAS INVERT 


;display new cursor 


CEF7:A2 00 


41 


PRET 


LDX 


f$0 


; return with no error 


CEF9:60 


42 




RTS 






CEFA: 


43 


* 








CEFA: 


44 


* HANDLE 


COTOXY STUFF: 




CEFA: 


45 


* 








CEFA: CEFA 


46 


GETX 


EOU 


* 




CEFA: 20 OB CC 


47 




JSR 


PASINVERT 


;turn off cursor 


CEFD:8A 


48 




TXA 




;get character 


CEFE:38 


49 




SEC 






CEFF:E9 AO 


50 




SBC 


#160 


;MAKE BINARY 


CF01:2C FB 06 


51 




BIT 


XCOORD 


;dolng X? 


CF04:30 2A CF30 


52 




BMI 


PSETX 


;->yea, set It 


CF06: 


53 


* 








CF06: 


54 


* Set Y a 


nd do 


the GOTOXY 




CF06: 


55 


* 








CF06: CF06 


56 


GETY 


EOU 


* 




CF06:8D FB 05 


57 




STA 


OURCV 




CF09:20 71 CF 


58 




JSR 


PASCALC 


;calc base addr 


CFOC:AC FB 06 


59 




LDY 


XCOORD 




CF0F:20 AD CC 


60 




JSR 


GETCUR2 


:set proper cursors 



l: 



I 



^ 

^ 

3 



Appendix I: Firmware Listings 



183 



CF12:A9 08 




61 


LDA 


tfH.GOXY 


CF1A:1C FB 


OA 


62 


TRB 


VMODE 


CF17:80 DB 


CEFA 


63 


BRA 


PWRET 


CF19: 




6A * 






CF19:20 OB 


GG 


65 PCTL 


JSR 


PAS INVERT 


CFIC:8A 




66 


TXA 




CF1D:C9 9E 




-7 


CMP 


*S9E 


CF1F:F0 08 


CF29 


68 


BEO 


STARTXY 


CF21:20 60 


C3 


69 


JSR 


SETROM 


CF2A:20 58 


CD 


70 


JSR 


CTLCHAR 


CF27:80 C8 


CEF1 


71 


BRA 


PWRITERET 


CF29: 




72 * 






CF29: 




73 * START THE GOTOXY SEQUEN 


CF29: 




7A * 






CF29: 


CF29 


75 START XY 


EQU 


* 


CF29:A9 08 




76 


LDA 


ffM.GOXY 


CF2B:0C FB 


t4 


77 


TSB 


VMODE 


CF2E:A9 FF 




78 


LDA 


flSFF 


CF30:8D FB 


06 


79 PSETX 


STA 


XCOORD 


CF33:80 BF 


CEFA 


80 


BRA 


PWRET 


CF35: 




81 * 






CF35: 




82 * PASCAL 


INPUT 




CF35: 




83 * 






CF35:20 5A 


CF 


8A PASREAD 


JSR 


PSETUP2 


CF38:20 8F 


C9 


85 GKEY 


JSR 


XRDKBD 


CF3B:10 FB 


CF38 


86 


BPL 


GKEY 


CF3D:29 7F 




B7 


AND 


#S7F 


CF3F:B0 B6 


CEF7 


88 


BRA 


PRET 


CFAl: 




89 * 






CFAl: 




90 * PASCAL 


INITIALIZATI 


CF41: 




91 * 






CFM: 


CFA1 


92 PINIT 


EQU 


* 


CFA1:A9 01 




93 


LDA 


M. MOUSE 


CFA3:20 3B 


CE 


9A 


JSR 


PVMODE 


CFA6:20 51 


CF 


95 


JSR 


PSETUP 


CFA9-.20 DA 


CD 


96 


JSR 


WIN80 


CFAC:20 58 


FC 


97 


JSR 


HOME 


CFAF:80 AO 


CEF1 


98 


BRA 


PWRITERET 


CF51: 




99 * 






CF51: 


CF51 


100 PSETUP 


EQU 


* 


CF51:20 60 


C3 


101 


JSR 


SETROM 


CF5A:6A 22 




102 PSETUP2 


STZ 


WNDTOP 


CF56:20 OA 


CE 


103 


JSR 


WNDREST 


CF59:A9 FF 




10A 


LDA 


#SFF 


CF5B:85 32 




105 


STA 


1NVFLG 


CF5D:A9 OA 




106 


LDA 


#M. VMODE 


CF5F:2C PB 


OA 


107 


BIT 


VMODE 


CF62:F0 02 


CF66 


108 


BEQ 


PS1 


CF64:46 32 




109 


LSR 


INVFLG 


CF66:AC 7B 


05 


110 PS1 


LDY 


OURCH 


CF69:20 AD 


CC 


111 


JSR 


GETCUR2 


CF6C:AD FB 


05 


112 


LDA 


OURCV 


CF6F:85 25 




113 


STA 


CV 


CF71: 




114 * 






CF71: 




115 * Put BASCALC 


here so we 


CF71: 




116 * In the 


ROMs 


for each ch 


CF71: 




117 * 






CF71:0A 




118 PASCALC 


ASL 


A 



;turn off gotoxy 

;->DONE (ALWAYS TAKEN) 

;turn off cursor 

;get char 

;is It gocoXY? 

;->yes, start It up 

;must switch In ROM for control! 

; EXECUTE IT IF POSSIBLE 

;->d!splay new cursor, exit 






turn on gotoxy 

set XCOORD to -I 

set X 

=>dlsplay cursor and exit 



; SETUP ZP STUFF 
;key pressed? 
;=>not yet 
;DROP HI BIT 
;good exit 



;Set mode to pascal 

;wlthout mouse characters 

;setup zero page for pascal 

;do A0->80 convert 

;home and clear screen 

jdisplay cursor, set OURCH, OURCV. 



;save LC state, set ROM read 
;set top to 

;lnit either AO or 80 window 
; assume normal text 

;ls it 

;=>yes 

;no, make flag Inverse 

;set all cursors 



in't have to switch 
:acter output. 



3 



!j 



184 



Appendix I: Firmware Listings 



1 










■— til 










l: 


CF72:A8 


119 TAY 


;calc base addr In BASL.H 




CF73.-4A 
CF74:4A 


120 LSR A 

121 LSR A 


; for given line no. 




m H 


CF75:29 03 


122 AND *$03 


; 0<=line no.<-$17 




L 


CF77:09 04 
CF79:85 29 


123 ORA #$4 

124 STA BASH 


; arg-OOOABCDE, generate 
; BASH=000001CD 




CF7B:98 


125 TYA 


;and 




c 


CF7C:6A 
CF7D:29 98 
CP7F:85 28 
CF81:0A 


126 ROR A 

127 AND #$98 

128 PASCLC2 STA BASL 

129 ASL A 


; BASL=EABAB000 




l~ 4 


CF82JOA 


130 ASL A 






h 


CF83:04 28 


131 TSB BASL 






CF85:60 


132 RTS 






CF86: 


30 INCLUDE AUXSTUFF 


;Aux RAM routines 




b 










E 










t 










F 










b 

l: 










■ 










l: 










k 










r 




Appendix 1: Firmware 


Listings 




1 185 



CF86: 




4 ********* 


****** 


************ 


************* 


CF86: 




5 * NAME 


: MOVEAUX 




CF86: 




6 * FUNCTION: PERFORM CROSSBANK MEMORY MOVE 


CF86: 




7 * INPUT 


: Al- 


SOURCE ADDRESS 


CF86: 




8 * 


: A2= 


SOURCE END 




CF86: 




9 * 


: A4- 


DESTINATION 


START 


CF86: 




10 * 


: CARRY 


->CARD 


CF86: 




11 * 




CLR-CARD- 


->MAIN 


CF86: 




12 * OUTPUT 


: NONE 




CF86: 




13 * VOLATILE: NOTHING 




CF86: 




14 * CALLS 


: NOTHING 




CF86: 




15 **************************************** 


CF86: 


CF86 


16 MOVEAUX 


EQU 


* 




CF86:48 




17 


PHA 




;SAVE AC 


CF87:AD 13 


CO 


18 


LDA 


RDRAMRD 


;SAVE STATE OF 


CF8A:48 




19 


PHA 




; MEMORY FLAGS 


CF8B:AD 14 


M 


20 


LDA 


RDRAMWRT 




CF8E:48 




21 


PHA 






CF8F: 




22 * 








CF8F: 




23 * SET FLAGS FOR CROSSBANK MOVE: 


CF8F: 




24 * 








CF8F:90 08 


CF99 


25 


BCC 


M0VEC2M 


;=>CARD— >MAIN 


CF91:8D 02 


CO 


26 


STA 


RDMAINRAM 


;SET FOR MAIN 


CF9A:8D 05 


CO 


27 


STA 


WRCARDRAM 


; TO CARD 


CF97:B0 06 


CF9F 


26 


BCS 


MOVESTRT 


;->( ALWAYS TAKEN) 


CF99: 




29 * 








CF99: 


CF99 


30 M0VEC2M 


EOU 


* 




CF99:8D 04 


CO 


31 


STA 


WRMAINRAM 


;SET FOR CARD 


CF9C:8D 03 


CO 


32 


STA 


RDCARDRAM 


; TO MAIN 


CF9F: 




33 * 








CF9F: 


CF9F 


34 MOVESTRT 


EOU 


* 




CF9F:B2 3C 




35 MOVE LOOP 


LDA 


(AIL) 


;Ret a byte 


CFA1:92 42 




36 


STA 


(A4L) 


;move it 


CFA3:F.6 42 




37 


INC 


A4L 




CFA5:D0 02 


CFA9 


38 


BNE 


NEXTA1 




CFA7:E6 43 




39 


INC 


A4H 




CFA9:A5 3C 




40 NEXTA1 


LDA 


AIL 




CFAB:C5 3E 




41 


CMP 


A2L 




CFAD:A5 3D 




42 


LDA 


A1H 




CFAF:E5 3F 




43 


SBC 


A2H 




CFB1:E6 3C 




.... 


INC 


AIL 




CFB3:D0 02 


CFB7 


v. 


BNE 


C01 




CFB5:E6 3D 




46 


INC 


A1H 




CFB7:90 E6 


CF9F 


47 C01 


BCC 


MOVELOOP 


;=>more Co move 


CFB9: 




48 * 








CFB9:8D 04 


CO 


49 


STA 


WRMAINRAM 


; CLEAR FLAC2 


CFBC:68 




30 


PLA 




;GET ORIGINAL ST^ 


CFBDtlO 03 


CFC2 


51 


BPL 


C03 


;=>IT WAS OFF 


CFBF:8D 05 


CO 


52 


STA 


WRCARDRAM 




CFC2: 


CFC2 


53 C03 


EOU 


* 




CFC2:8D 02 


CO 


54 


STA 


RDMAINRAM 


; CLEAR FLAG1 


CFC5:68 




55 


PLA 




;GET ORIGINAL ST* 


CFC6:10 03 


CFCB 


56 


BPL 


MOVERET 


;->IT WAS OFF 


CFC8:8D 03 


CO 


57 


STA 


RDCARDRAM 




CFCB: 


CFCB 


58 MOVERET 


EOU 


* 




CFCB:68 




59 


PLA 




;Restore AC 


CFCC:60 




60 


RTS 







186 



Appendix I: Firmware Listings 



CFCD: 






62 


*********** ***************************** 


CFCD: 






63 


* 


NAME 




XFER 




CFCD: 






64 


* 


FUNCTION 


TRANSFER CONTROL 


CROSSBANK 


CFCD: 






65 


* 


INPUT 




S03ED-TRANSFER ADDR 


CFCD: 






66 


* 






CARRY SF.T-XFER TO 


CARD 


CFCD: 






67 


* 






CLR-XFER TO 


MAIN 


CFCD: 






68 


' 






VFLAC CLR-USE STD 


ZP/STK 


CFCD: 






69 


* 








SET=USE ALT 


ZP/STK 


CFCD: 






70 


* 


OUTPUT 




NONE 




CFCD: 






71 


* 


VOLATILE 


S03ED/03EE IN DEST BANK 


CFCD: 






72 


* 


CALLS 




NOTHING 




CFCD: 






73 


« 


NOTE 




ENTERED VIA JMP, 


NOT JSR 


CFCD: 






74 


**************************************** 


CFCD: 






75 


* 










CFCD: 




CFCD 


76 


XFER 


EQU 


* 




CFCD: 48 






77 






PHA 




;SAVE AC ON CURRENT STACK 


CFCE: 






78 


* 










CFCE: 






79 


* 


COPY DESTINATION ADDRESS TO 


THE 


CFCE: 






80 


* 


OTHER 


BANK 


SO THAT WE HAVE 


IT 


CFCE: 






81 


* 


IN CASE WF. 


DO A SWAP: 




CFCE: 






82 


• 










CFCE:AD 


ED 


03 


83 






LDA 


S03ED 


;GET XPERADDR LO 


CFD1:48 






84 






PHA 




;SAVE ON CURRENT STACK 


CFD2:AD 


EE 


03 


85 






LDA 


S03BH 


;GET XFERADDR HI 


CFD5:48 






86 






PHA 




-.SAVE IT TOO 


CFD6: 






87 


■ 










CFD6: 






88 


* 


SWITCH 


TO APPROPRIATE BANK: 




CFD6: 






89 


* 










CFD6:90 


08 


CFEO 


90 






BCC 


XFERC2M 


;=>CARD — >MAIN 


CFD8:8D 


03 


CO 


91 






STA 


RDCARDRAM 


;SET FOR RUNNING 


CFDB:8D 


05 


CO 


92 






STA 


WRCARDRAM 


; IN CARD RAM 


CFDE:BO 


06 


CFE6 


93 






BCS 


XFERZP 


;-> alwaya taken 


CFEO: 




CFEO 


94 


XFERC2M 


EQU 


* 




CFEO : 3D 


02 


CO 


95 






STA 


RDMAiNRAM 


;SET FOR RUNNING 


CFE3:8D 


04 


CO 


96 






STA 


WRMAINRAM 


; IN MAIN RAM 


CFE6: 






97 


* 










CFE6: 




CFE6 


98 


XFERZP 


EQU 


* 


;SWITCH TO ALT ZP/STK 


CFE6:68 






99 






PLA 




-.STUFF XFERADDR 


CFE7:8D 


EE 


03 


100 






STA 


S03EE 


; HI AND 


CFEA:68 






101 






PLA 






CFEB:8D 


ED 


03 


102 






STA 


S03ED 


; LO 


CFEE:68 






103 






PLA 




; RESTORE AC 


CFEF:70 


OS 


CFF6 


104 






BVS 


XFERAZP 


;->switch In alternate zp 


CFF1:8D 


08 


CO 


105 






STA 


SETSTDZP 


;else force standard zp 


CFF4:50 


03 


CFP9 


106 






BVC 


JMPDEST 


;->always perform transfer 


CFF6:8D 


09 


CO 


107 


XFERAZP 


STA 


SETALTZP 


; switch In alternate zp 


CFF9:6C 


ED 


03 


108 


JMPDEST 


JMP 


(S03ED) 


; iB >off we go 


CFFC: 






109 


**************************************** 


CFFC: 




0004 


110 






DS 


SD000-*,S00 




NEXT 


OBJECT 


FILE 


NAME IS FIRM.l 






F800: 




F800 


31 






ORG 


F80RG 




F800: 






32 






INCLUDE AUT0ST1 


:F8 monitor rom 



Appendix I: Firmware Listings 



187 



F800: 

F801: 

F802: 

F805; 

F806: 

F808: 

F80A: 

F80C: 

F80E 

F810: 

F812: 

F814: 

F816: 

F818; 

F819; 

F819: 

F8IC: 

F81E: 

F820: 

F821: 

F824: 

F826: 

P828: 

F829: 

F82C; 

F82D; 

F82F: 

F831; 

F832: 

F832: 

F834: 

F836: 

F838: 

F83A: 

F83A: 

F83C: 

F83E: 

F840: 

F843: 

F844: 

F846: 

F847: 

F847: 

F848: 

F849i 

F84B: 

F84Di 

FB4F: 

F850: 

F852i 

F854; 

F856: 

F858: 

F859: 

FB5A: 

F85C: 

F85E: 

F85F! 



4A 
08 

20 47 F8 
28 

A9 OF 
90 02 
69 EO 
85 2E 
:B1 26 
45 30 
25 2E 



PBOC 



20 00 F8 

C4 2C 

BO 11 

C8 

20 OE F8 

90 F6 

69 01 

48 

20 00 F8 

68 

C5 2D 

90 F5 

60 



F831 



F8IC 



P826 



AO 2F 

DO 02 F838 

AO 27 

84 2D 



AO 27 
A9 00 
85 30 
20 28 F8 
88 

10 F6 
60 



F83C 



48 

4A 

29 03 
09 04 
85 27 
68 

29 18 
90 02 
69 7F 
85 26 
OA 
OA 

05 26 
85 26 
60 



P85fi 



3 PLOT 
4 

6 

7 



10 RTMASK 

11 PLOT I 
12 

13 
14 

15 

16 

17 
18 



* 

HLINE 
19 HLINE 1 
20 
21 
22 
23 

24 VLINEZ 

25 VLINE 
26 

27 
28 
29 

30 RTS1 

31 * 

32 CLRSCR 
33 

34 CLRTOP 

35 CLRSC2 

36 ; 
37 

38 CLRSC3 

39 

40 

41 

4 2 

43 

44 * 

45 GBASCALC 
46 

47 

48 

49 

50 

51 

52 

53 

54 GBCALC 

55 

56 

57 

58 

59 

60 * 



LSR 
PHP 
JSR 

PLP 
LDA 
BCC 
ADC 
STA 
LDA 
EOR 
AND 
EOR 
STA 
RTS 

JSR 
CPY 
BCS 

INY 
JSR 
BCC 
ADC 
PHA 
JSR 
PLA 
CMP 
BCC 
RTS 

LDY 
BNE 
LDY 

STY 

LDY 
LDA 
STA 
JSR 
DEY 
BPL 
RTS 

PHA 
LSR 

AND 
ORA 
STA 
PLA 
AND 
BCC 
ADC 
STA 
ASL 
ASL 
ORA 
STA 
RTS 



GBASCALC 

#$0F 
RTMASK 
#$E0 
MASK 

(GBASL), Y 
COLOR 
MASK 

(GBASL) ,Y 
(GBASL), Y 



PLOT 
H2 

RTS1 

PL0T1 

HLINE1 

#$01 

PLOT 

V2 
VLINEZ 



#$2F 
CLRSC2 
#$27 
V2 

#$27 
#$00 
COLOR 
VLINE 

CLRSC3 



A 

#$03 
#$04 
GBASH 

#$18 
GBCALC 
#$7F 
GBASL 

A 
A 

GBASL 
GBASL 



Y-C00RD/2 

SAVE LSB IN CARRY 

CALC BASE ADR IN GBASL, H 

RESTORE LSB FROM CARRY 

MASK $0P IF EVEN 

MASK $F0 IF ODD 

DATA 
XOR COLOR 
AND MASK 
XOR DATA 
TO DATA 



;PLOT SQUARE 

;DONE? 

; YES, RETURN 

; NO, INCR INDEX (X-COORD) 

;PLOT NEXT SQUARE 

; ALWAYS TAKEN 

;NEXT Y-COORD 

; SAVE ON STACK 

; PLOT SQUARE 



; DONE 7 

; NO, LOOP. 



;MAX Y, FULL SCRN CLR 

; ALWAYS TAKEN 

;MAX Y, TOP SCRN CLR 

; STORE AS BOTTOM COORD 

FOR VLINE CALLS 

;RIGHTMOST X-COORD (COLUMN) 

;TOP COORD FOR VLINE CALLS 

; CLEAR COLOR (BLACK) 

;DRAW VLINE 

;NEXT LEFTMOST X-COORD 

;LOOP UNTIL DONE. 



;FOR INPUT OODEFGH 

; GENERATE GBASH-000001FG 
;AND CBASL=HDEDE000 



188 



Appendix I: Firmware Listings 



F85F:A5 30 


6] 


NXTCOL 


LDA 


COLOR 


F861: 18 


63 




CLC 




F862:69 03 


63 




ADC 


#$03 


F864:29 OF 


64 


SETCOL 


AND 


#$0F 


F866:85 30 


65 




STA 


COLOR 


F868:0A 


66 




ASL 


A 


F869:0A 


b7 




ASL 


A 


F86A:0A 


68 




ASL 


A 


F86B:0A 


69 




ASL 


A 


F86C:05 30 


70 




ORA 


COLOR 


F86E:85 30 


71 




STA 


COLOR 


F870:60 


11 




RTS 




F871: 


n 


* 






F87l;4A 


74 


SCRN 


LSR 


A 


F872:08 


75 




PHP 




F873:20 47 F8 


76 




JSR 


GBASCALC 


F876:B1 26 


77 




LDA 


(GBASL).Y 


F878:28 


78 




PLP 




F879:90 04 F87F 


79 


SCRN2 


BCC 


RTMSKZ 


F87B:4A 


80 




LSR 


A 


F87C:4A 


81 




LSR 


A 


F87D:4A 


82 




LSR 


A 


F87E:4A 


83 




LSR 


A 


F87F:29 OF 


84 


RTMSKZ 


AND 


#$0F 


F881:60 


85 




RTS 




F882: 


86 


* 






F882:A6 3A 


87 


INSDS1 


LDX 


PCL 


F884:A4 3B 


88 




LDY 


PCH 


F886:20 96 FD 


89 




JSR 


PRYX2 


F889:20 48 P9 


90 




JSR 


PRBLNK 


F88C:A1 3A 


91 


INSDS2 


LDA 


(PCL.X) 


F88E:A8 


92 




TAY 




F88F:4A 


93 




LSR 


A 


F890:90 05 F897 


94 




BCC 


IEVEN 


F892:6A 


95 




ROR 


A 


F893:B0 OC F8A1 


96 




BCS 


ERR 


F895:29 87 


97 




AND 


#587 


F897:4A 


9B 


I EVEN 


LSR 


A 


F898:AA 


99 




TAX 




F899:BD 62 F9 


100 




LDA 


FMT1.X 


F89C:20 79 F8 


101 




JSR 


SCRN2 


F89F:D0 04 F8A5 


102 




BNE 


GETFMT 


F8A1:A0 FC 


103 


ERR 


LDY 


tf$FC 


F8A3:A9 00 


104 




LDA 


#$00 


F8A5:AA 


105 


GETFMT 


TAX 




F8A6:BD A6 F9 


106 




LDA 


FMT2.X 


F8A9:85 2E 


107 




STA 


FORMAT 


F8AB:29 03 


108 




AND 


#S03 


F8AD: 


109 


; (0-1 


BYTE, 1- 


2 BYTE, 2< 


F8AD:85 2F 


110 




STA 


LENGTH 


F8AF:20 35 FC 


111 




JSR 


NEWOPS 


F8B2:F0 18 F8CC 


112 




BEQ 


GOTONE 


F8B4:29 8F 


113 




AND 


#S8F 


F8B6:AA 


114 




TAX 




F8B7:98 


115 




TYA 




F8B8:A0 03 


116 




LDY 


#$03 


F8BA.-E0 8A 


117 




CPX 


#$8A 


F8BC:P0 OB F8C9 


118 




BEO 


MNNDX3 



; INCREMENT COLOR BY 3 

;SETS C0L0R=17*A MOD 16 

;BOTH HALF BYTES OF COLOR EQUAL 



;READ SCREEN Y-COORD/2 
;SAVE LSB (CARRY) 
;CALC BASE ADDRESS 
;GET BYTE 

; RESTORE LSB FROM CARRY 
;1F EVEN, USE LO H 



; SHIFT HIGH HALF BYTE DOWN 
;MASK 4-BITS 



;PRINT PCL.H 



; FOLLOWED BY A BLANK 
;CET OPCODE 

; EVEN/ODD TEST 

;BIT 1 TEST 

jXXXXXXll INVALID OP 

;MASK BITS 

;LSB INTO CARRY FOR L/R TEST 

;GET FORMAT INDEX BYTE 
;R/L H-BYTE ON CARRY 

; SUBSTITUTE $FC FOR INVALID OPS 
;SET PRINT FORMAT INDEX TO 

; INDEX INTO PRINT FORMAT TABLE 
;SAVE FOR ADR FIELD FORMATTING 
;MASK FOR 2-BIT LENGTH 



;get index for new opcodes 
; found a new op (or no op) 

;MASK FOR 1XXX1010 TEST 

; SAVE IT 

[OPCODE TO A AGAIN 



Appendix I: Firmware Listings 



189 



F8BE:4A 




119 


MNNDXl 


LSR 


A 


F8BF:90 08 


F8C9 


120 




BCC 


MNNDX3 


F8C1:4A 




121 




LSR 


A 


F8C2:4A 




122 


HNNDX2 


LSR 


A 


F8C3:09 20 




123 




ORA 


#$20 


F8C5:88 




124 




DEY 




F8C6:D0 FA 


F8C2 


125 




BNE 


HNNDX2 


F8C8:C8 




126 




INY 




F8C9:88 




127 


NNNDX3 


DEY 




F8CA:D0 F2 


F8BE 


128 




BNE 


MNNDX1 


F8CC:60 




129 


GOTONE 


RTS 




F8CD: 




130 


* 






F8CD:FP FF 


FF 


131 




DFB 


SFF.SFF.SFF 


F8DO: 




132 


• 






FBD0:20 82 


F8 


133 


INSTDSP 


JSR 


INSDSl 


F8D3:48 




134 




PHA 




F8D4:B1 3 A 




135 


PRNTOP 


LDA 


(PCL).Y 


F8D6:20 DA 


PD 


136 




JSR 


PRBYTE 


F8D9:A2 01 




137 




LDX 


#501 


F8DB:20 4A 


F9 


138 


PRNTBL 


JSR 


PRBL2 


F8DE:C4 2F 




139 




CPY 


LENGTH 


F8E0:C8 




140 




INY 




F8E1:90 Fl 


F8D4 


141 




BCC 


PRNTOP 


P8E3:A2 03 




142 




LDX 


#$03 


F8E5:C0 04 




143 




CPY 


#$04 


F8E7:90 F2 


F8DB 


144 




BCC 


PRNTBL 


F8E9:68 




145 




PLA 




F8EA:A8 




146 




TAY 




F8EB:B9 CO 


F9 


147 




LDA 


MNEML.Y 


F8EE:85 2C 




148 




STA 


1.MNEM 


F8F0:B9 00 


FA 


149 




LDA 


MNEMR.Y 


F8F3:85 2D 




150 




STA 


RMNEM 


F8F5:A9 00 




151 


PRMN1 


LDA 


#$00 


F8F7:AO 05 




152 




LDY 


#$05 


F8F9:06 2D 




153 


PRMN2 


ASL 


RMNEM 


F8FB:26 2C 




154 




ROL 


LMNEM 


F8FD:2A 




155 




ROL 


A 


F8FE:88 




156 




DEY 




F8FF:D0 F8 


F8F9 


157 




BNE 


PRMN2 


F90l:69 BF 




158 




ADC 


#$BF 


F903:20 ED 


FD 


159 




JSR 


COUT 


F906:CA 




160 




DEX 




F907:D0 EC 


F8F5 


161 




BNE 


PRMN1 


F909:20 48 


F9 


162 




JSR 


PRBLNK 


F90C:A4 2F 




163 




LDY 


LENGTH 


F90E:A2 06 




164 




LDX 


#$06 


F910:E0 03 




165 


PRADRl 


CPX 


#$03 


F912:F0 1C 


F930 


166 




BEQ 


PRADR5 


F914:06 2E 




167 


PRADR2 


ASL 


FORMAT 


F916:90 OE 


F926 


168 




BCC 


PRADR3 


F918:BD B9 


F9 


169 




LDA 


CHAR1-1.X 


F91B:20 ED 


FD 


170 




JSR 


COUT 


F91E:BD B3 


F9 


171 




LDA 


CHAR2-1.X 


F921:FO 03 


F926 


172 




BEQ 


PRADR3 


F923:20 ED 


FD 


173 




JSR 


COUT 


F926:CA 




174 


PRADR3 


DEX 




F927:D0 E7 


F910 


175 




BNE 


PRADRl 


F929:60 




176 




RTS 





;FORM INDEX INTO MNEMONIC TABLE 

; 1) 1XXX10I0 »> 00101XXX 

; 2) XXXYYY01 -> 00U1XXX 

; 3) XXXYYY10 -> 00110XXX 

; 4) XXXYY100 =■> OOIOOXXX 

; 5) XXXXXOOO -> OOOXXXXX 



;GEN FMT, LEN BYTES 

;SAVE MNEMONIC TABLE INDEX 



; PRINT 2 BLANKS 

; PRINT INST (1-3 BYTES) 
;IN A 12 CHR FIELD 

;CHAR COUNT FOR MNEMONIC INDEX 



; RECOVER MNEMONIC INDEX 



; FETCH 3-CHAR MNEMONIC 
; (PACKED INTO 2-BYTES) 



;SHIFT 5 BITS OF CHARACTER INTO A 
; (CLEARS CARRY) 



;ADD "?" OFFSET 

; OUTPUT A CHAR OF MNEM 



;OUTPUT 3 BLANKS 

;CNT FOR 6 FORMAT BITS 

;IF X=3 THEN ADDR. 



J 



190 



Appendix I: Firmware Listings 



F92A: 






177 * 








F92A:88 






178 PRADR4 


DEY 






F92B:30 


E7 


F914 


179 


BMI 


PRADR2 




F92D:20 


DA 


FD 


180 


JSR 


PRBYTE 




F930:A5 


2E 




181 PRADR5 


LDA 


FORMAT 




F932:C9 


Bfl 




182 


CMP 


#SE8 


; HANDLE REL ADR MODE 


F934:B1 


3A 




183 


LDA 


(PCL).Y 


;SPECIAL (PRINT TARGET. 


F936:90 


P2 


F92A 


184 


BCC 


PRADR4 


; NOT OFFSET) 


F938:20 


56 


F9 


185 RELADR 


JSR 


PCADJ 3 




F93B:AA 






186 


TAX 




;PCL,PCH+OFFSET+l TO A,Y 


F93C:E8 






187 


INX 






F93D:D0 


01 


F940 


188 


BNE 


PRNTYX 


;+l TO Y,X 


F93F:C8 






189 


INY 






F940:98 






190 PRNTYX 


TYA 






F94l:20 


DA 


FD 


191 PRNTAX 


JSR 


PRBYTE 


; OUTPUT TARGET ADR 


F944:8A 






192 PRNTX 


TXA 




; OF BRANCH AND RETURN 


F945:4C 


DA 


FO 


193 


JMP 


PRBYTE 




F948: 






194 * 








F948:A2 


03 




195 PRBLNK 


LDX 


#$03 


; BLANK COUNT 


F94A:A9 


A0 




196 PRBL2 


LDA 


#$A0 


;LOAD A SPACE 


F94C:20 


ED 


FD 


197 PRBL3 


JSR 


COUT 


; OUTPUT A BLANK 


F94F:CA 






198 


DEX 






F950:DO 


F8 


F94A 


199 


BNE 


PRBL2 


;LOOP UNTIL COUNT-0 


F952:60 






200 


RTS 






F953: 






201 * 








F953:38 






202 PCADJ 


SEC 




;0-l BYTE, 1-2 BYTE, 


F954:A5 


2F 




203 PCADJ 2 


LDA 


LENGTH 


; 2-3 BYTE 


F956:A4 


3B 




204 PCADJ 3 


LDY 


PCH 




F958:AA 






205 


TAX 




;TEST DISPLACEMENT SIGN 


F959:10 


1 


F95C 


206 


BPL 


PCADJ4 


; (FOR REL BRANCH) 


F95B:88 






207 


DEY 




; EXTEND NEC BY DECR PCH 


F95C:65 


3A 




208 PCADJ4 


ADC 


PCL 




F95E:90 


01 


F961 


209 


BCC 


RTS2 


;PCL+LENGTH(OR DISPL)+1 TO A 


F960:C8 






210 


INY 




; CARRY INTO Y (PCH) 


F961:60 






211 RTS2 


RTS 






F962: 






212 * 








F962: 






213 ; FMT1 BYTES: 


XXXXXXYO INSTRS 


F962: 






214 ; IF Y-0 




THEN RIGHT 


HALF BYTE 


F962: 






215 ; IF Y-l 




THEN LEFT HALF BYTE 


F962: 






216 ; 




(X=INDEX) 




F962: 






217 * 








F962:0F 






218 FMT1 


DFB 


SOF 




F963:22 






219 


DFB 


S22 




F964 : FF 






220 


DFB 


SPF 




F965:33 






221 


DFB 


S33 




F966:CB 






222 


DFB 


SCB 




F967:62 






223 


DFB 


$62 




F968:FF 






224 


DFB 


$FF 




F969:73 






225 


DFB 


$73 




F96A-.03 






226 


DFB 


$03 




F96B:22 






227 


DFB 


S22 




F96C:FF 






228 


DFB 


SFF 




F96D:33 






229 


DFB 


$33 




F96E:CB 






230 


DFB 


SCB 




F96F:66 






231 


DFB 


S66 




F970:FF 






232 


DFB 


SFF 




F97l:77 






233 


DFB 


577 




F972:OF 






234 


DFB 


SOF 





Appendix I: Firmware Listings 



191 



F973:20 


235 


DFB 


S20 




F974:FF 


236 


DFB 


SFF 




F975:33 


237 


DFB 


$33 




F976:CB 


238 


DFB 


SCB 




F977:60 


239 


DFB 


S60 




F978:FF 


240 


DFB 


SFF 




F979:70 


241 


DFB 


$70 




F97A:OF 


242 


DFB 


SOF 




F97B:22 


243 


DFB 


$22 




F97C:FF 


244 


DFB 


$FF 




F97D:39 


245 


DFB 


$39 




F97E:CB 


246 


DFB 


SCB 




F97F:66 


247 


DFB 


$66 




F980:FF 


248 


DFB 


SFF 




F981:7D 


249 


DFB 


$7D 




F982:0B 


250 


DFB 


SOB 




F983:22 


251 


DFB 


$22 




F984:FF 


252 


DFB 


SFF 




F985:33 


253 


DFB 


$33 




F986:CB 


254 


DFB 


$CB 




F987:A6 


255 


DFB 


$A6 




F988:FF 


256 


DFB 


SFF 




F989:73 


257 


DFB 


$73 




F98A:11 


258 


DFB 


sn 




F98B:22 


259 


DFB 


$22 




F98C:FF 


260 


DFB 


$FF 




F98D:33 


261 


DFB 


$33 




F98E:CB 


262 


DFB 


$CB 




F98F:A6 


263 


DFB 


$A6 




F990:FF 


264 


DFB 


SFF 




F991:87 


265 


DFB 


$87 




F992:01 


266 


DFB 


$01 




F993:22 


267 


DFB 


$22 




F994:FF 


268 


DFB 


SFF 




F995:33 


269 


DFB 


$33 




F996:CB 


270 


DFB 


SCB 




F997-.60 


271 


DFB 


$60 




F998:FF 


272 


DFB 


$FF 




F999:70 


273 


DFB 


$70 




F99A:01 


274 


DFB 


501 




F99B:22 


275 


DFB 


$22 




F99C:FF 


276 


DFB 


SFF 




F99D:33 


277 


DFB 


$33 




F99E:CB 


278 


DFB 


SCB 




F99F:60 


279 


DFB 


$60 




P9A0:FF 


280 


DFB 


SFF 




P9A1:70 


281 


DFB 


$70 




F9A2 : 24 


282 


DFB 


$24 




F9A3:31 


283 


DFB 


$31 




F9A4:65 


284 


DFB 


$65 




F9A5:78 


285 


DFB 


S78 




F9A6: 


286 


; ZZXXXY01 INSTR'S 




F9A6:00 


287 


FMT2 DFB 


$00 


ERR 


F9A7:21 


288 


DFB 


$21 


1MM 


F9A8:81 


289 


DFB 


$81 


Z-PAGE 


F9A9:82 


290 


DFB 


$82 


ABS 


F9AA:59 


291 


DFB 


$59 


(ZPAG.X) 


F9AB:4D 


292 


DFB 


$4D 


(ZPAC).Y 






& 



192 



Appendix I: Firmware Listings 



F9AC:91 


293 


DFB 


S91 ; 


£PAG,X 


P9AD:92 


294 


DFB 


S92 


ABS.X 


F9AE:86 


295 


DFB 


$86 


ABS.Y 


F9AF:4A 


296 


DFB 


$4A 


(ABS) 


F9B0:85 


297 


DFB 


$85 


ZPAG.Y 


F9B1:9D 


298 


DFB 


$9D 


RELATIVE 


F9B2:49 


299 


DFB 


$49 ; 


ZPAG) (new) 


F9B3:5A 


300 


DFB 


$5A ; 


ABS.X) (new) 


F9B4: 


301 * 








F9B4:D9 


302 CHAR2 


DFB 


$D9 


'Y' 


F9B5:00 


303 


DFB 


$00 ; 


(byte F of FMT2) 


F9B6:D8 


304 


DFB 


$D8 


. Y , 


F987:A4 


305 


DFB 


$A4 


'$' 


F9B8:A4 


306 


DFB 


$A4 


'$• 


F9B9:00 


307 


DFB 


$00 




F9BA: 


308 * 








F9BA:AC 


309 CHAR1 


DFB 


SAC 


• • 

« 


P9BB:A9 


310 


DFB 


$A9 


')' 


F9BC:AC 


311 


DFB 


$AC 


t i 

t 


F9BD:A3 


312 


DFB 


$A3 


•#' 


F9BE:A8 


313 


DFB 


$A8 


'C 


F9BF:A4 


314 


DFB 


$A4 


'$' 


F9C0:1C 


315 MNEML 


DFB 


$1C 




F9C1:8A 


316 


DFB 


$8A 




F9C2:1C 


317 


DFB 


$1C 




F9C3:23 


318 


DFB 


$23 




F9C4:5D 


319 


DFB 


$5D 




F9C5:8B 


320 


DFB 


$8B 




F9C6:1B 


321 


DFB 


$1B 




F9C7:A1 


322 


DFB 


$A1 




F9C8:9D 


323 


DFB 


$9D 




F9C9:8A 


324 


DFB 


$8A 




F9CA:1D 


325 


DFB 


SID 




F9CB:23 


326 


DFB 


$23 




F9CC:9D 


327 


DFB 


$9D 




F9CD:8B 


328 


DFB 


$8B 




F9CE:1D 


329 


DFB 


$1D 




F9CF:A1 


330 


DFB 


$A1 




F9D0:1C 


331 


DFB 


$1C ;BRA 


F9Dl:29 


332 


DFB 


$29 




F9D2:19 


333 


DFB 


S19 




F9D3:AE 


334 


DFB 


$AE 




F9D4:69 


335 


DFB 


$69 




F9D5:A8 


336 


DFB 


$A8 




F9D6:19 


337 


DFB 


$19 




F9D7:23 


338 


DFB 


$23 




F9D8:24 


339 


DFB 


$24 




F9D9:53 


340 


DFB 


$53 




F9DA:1B 


341 


DFB 


SIB 




F9DB:23 


342 


DFB 


$23 




F9DC:24 


343 


DFB 


$24 




F9DD:53 


344 


DFB 


$53 




F9DE:19 


345 


DFB 


S19 




F9DF:A1 


346 


DFB 


$A1 ; 


(A) FORMAT ABOVE 


F9E0:AD 


347 


DFB 


SAD ; 


TSB 


F9E1:1A 


348 


DFB 


$1A 




F9E2:5B 


349 


DFB 


S5B 




F9E3:5B 


350 


DFB 


$5B 





Appendix I: Firmware Listings 



193 



F9E4:A5 


351 


DFB 


SA5 




F9E5:69 


352 


DFB 


$69 




F9E6:24 


353 


DFB 


S24 




F9E7:24 


354 


DFB 


$24 


; (B) FORMAT 


F9E8:AE 


355 


DFB 


SAE 




F9E9:AE 


356 


DFB 


SAE 




F9EA:A8 


357 


DFB 


SA8 




F9EB:AD 


358 


DFB 


SAD 




F9EC:29 


359 


DFB 


$29 




F9ED:8A 


360 


DFB 


$8A 




F9EE:7C 


361 


DFB 


$7C 




F9EF:8B 


362 


DFB 


S8B 


; (C) FORMAT 


F9F0:15 


363 


DFB 


$15 




F9F1:9C 


364 


DFB 


$9C 




F9F2:6D 


365 


DFB 


$6D 




F9F3:9C 


366 


DFB 


$9C 




F9F4:A5 


367 


DFB 


$A5 




F9F5:69 


368 


DFB 


$69 




F9F6:29 


369 


DFB 


$29 




F9F7:53 


370 


DFB 


$53 


; (D) FORMAT 


F9F8:84 


371 


DFB 


S84 




F9F9:13 


372 


DFB 


$13 




F9FA:34 


373 


DFB 


$34 




F9FB: 11 


374 


DFB 


$11 




F9FC:A5 


375 


DFB 


SA5 




F9FD:69 


376 


DFB 


$69 




F9FE:23 


377 


DFB 


$23 


; (E) FORMAT 


F9FF:A0 


378 


DFB 


SAO 




FAOO: 


379 * 








FAOO:D8 


380 MNEMR 


DFB 


SD8 




FAOU62 


381 


DFB 


$62 




FA02:5A 


382 


DFB 


$5A 




FA03:48 


383 


DFB 


$48 




FA04:26 


384 


DFB 


$26 




FA05:62 


385 


DFB 


$62 




FA06:94 


386 


DFB 


S94 




FA07:88 


387 


DFB 


$88 




PA08:54 


388 


DFB 


$54 




PA09:44 


389 


DFB 


$44 




FA0A:C8 


390 


DFB 


$C8 




FAOB:54 


391 


DFB 


S54 




FA0C:68 


392 


DFB 


$68 




FAOD:44 


393 


DFB 


$44 




FAOE:E8 


394 


DFB 


SE8 




FA0F:94 


395 


DFB 


$94 




FA10:C4 


396 


DFB 


$C4 


;BRA 


FA11-.B4 


397 


DFB 


$B4 




FA12:08 


398 


DFB 


$08 




FA 13: 84 


399 


DFB 


S84 




FA14:74 


400 


DFB 


$74 




FA15:B4 


401 


DFB 


$B4 




FA16:28 


402 


DFB 


$28 




FA17:6E 


403 


DFB 


$6E 




FA18:74 


404 


DFB 


$74 




FA19:F4 


405 


DFB 


$F4 




FA1A:CC 


406 


DFB 


$CC 




FA1B:4A 


407 


DFB 


$4A 




FA1C:72 


408 


DFB 


$72 





Appendix I: Firmware Listings 



FA1D:F2 


409 




DFB 


SF2 






FA1E:A4 


410 




DFB 


SA4 






FA1F:8A 


411 




DFB 


SflA 




; (A) FORMAT 


FA20:06 


412 




DFB 


S06 




; TSB 


FA21:AA 


413 




DFB 


SAA 






FA22:A2 


414 




DFB 


SA2 






FA23:A2 


415 




DFB 


SA2 






FA24:74 


416 




DFB 


$74 






FA25:74 


417 




DFB 


$74 






FA26:74 


418 




DFB 


$74 






FA27:72 


419 




DFB 


$72 




; (B) FORMAT 


FA28:44 


420 




DFB 


$44 






FA29:68 


421 




DFB 


$68 






FA2A:B2 


422 




DFB 


$B2 






FA2B:32 


423 




DFB 


$32 






FA2C:B2 


424 




DFB 


$B2 






FA2D:72 


425 




DFB 


$72 






FA2E:22 


426 




DFB 


$22 






FA2F:72 


427 




DFB 


$72 




; (C) FORMAT 


FA30: 1A 


428 




DFB 


$1A 






FA31:1A 


429 




DFB 


$1A 






FA32:26 


430 




DFB 


$26 






FA33:26 


431 




DFB 


$26 






FA34:72 


432 




DFB 


$72 






FA35:72 


433 




DFB 


$72 






FA36 : 88 


434 




DFB 


S88 






FA37:C8 


435 




DFB 


$C8 




; (D) FORMAT 


FA38:C4 


436 




DFB 


$C4 






FA39:CA 


437 




DFB 


$CA 






PA3A:26 


438 




DFB 


$26 






FA3B:48 


439 




DFB 


$48 






FA3C:44 


440 




DFB 


$44 






FA3D:44 


441 




DFB 


$44 






FA3E:A2 


442 




DFB 


$A2 






FA3F:C8 


443 




DFB 


$C8 




; (E) FORMAT 


FA40: 


444 * 












FA40:48 


445 IRQ 


PHA 






;save accumulator 


FA4 1 : 68 


446 




PLA 






; rescued by stack trick later 


FA42:68 


447 




PLA 








FA43 : 4C 06 C8 


448 




JMP 


IRQ1 




;do rest of IRQ handler 


FA46: 


449 * 












FA46:EA 


450 




NOP 








FA47: 


451 * 












FA47: 


452 * 


NEWBRK is called by 


the 


interrupt handler which has 


FA47: 


453 * 


set 


the hardware to 


its 


default state and encoded 


FA47: 


454 * 


the 


state In 


the accumu 


lator. Software that wants 


FA47: 


455 * 


to do break p 


rocess: 


Lng i 


using full system resources 


FA47: 


456 * 


can 


restore t 


he machine 


state from this value. 


FA47: 


457 * 












FA47:85 44 


458 NEWBRK STA 


MAC STAT 


;save state of machine 


FA49:7A 


459 




PLY 






; restore registers for save 


FA4A:FA 


460 




PLX 








FA4B:68 


461 




PLA 








FA4C: 


462 * 












FA4C:28 


463 BREAK 


PLP 






;Note: same as old BREAK routine 


FA4D:20 4A FF 


464 




JSR 


SAVE 




;save reg's on BRK 


FA50:68 


465 




PLA 






; including PC 


FA5l:85 3A 


466 




STA 


PCL 







Appendix I: Firmware Listings 



195 



FA53 : 68 






467 






PLA 






FA54:85 


3B 




468 






STA 


PCH 




FA56:6C 


FO 


03 


469 






JMP 


(BRKV) 


;call BRK HANDLER 


FA59: 






470 


* 










FA59:20 


82 


F8 


471 


OLDBRK 


JSR 


INSDS1 


;PRINT USER PC 


FA5C:20 


DA 


FA 


472 






JSR 


RGDSP 1 


; AND REGS 


FA5F:4C 


65 


FF 


473 






JMP 


MON 


;G0 TO MONITOR (NO PASS GO, N 


FA62: 






474 


* 










FA62:D8 






475 


RESR 


CLD 




;DO THIS FIRST THIS TIME 


FA63:20 


B4 


re 


476 






JSR 


SET NORM 




FA66 : 20 


2F 


Ft'. 


477 






JSR 


INIT 




FA69:20 


93 


FF 


478 






JSR 


SETVID 




FA6C:20 


Bg 


FE 


479 






JSR 


SETKBD 




FA6F:20 


ic 


C4 


480 






JSR 


INITMOUSE 


initialize the mouse 


FA72:20 


04 


CG 


481 






JSR 


CLRPORT 


;clear port setup bytes 


FA75:9C 


FF 


04 


482 






STZ 


ACIABUF 


;and the commahead buffer 


FA78:AD 


SF 


CO 


483 






LDA 


SETAN3 


; AN3 = TTL HI 


FA7B:20 


P.I) 


FA 


484 






JSR 


RESET. X 


; initialize other devices 


FA7E:2C 


10 


CO 


485 






BIT 


KBDSTRB 


; CLEAR KEYBOARD 


FA81:D8 






486 


NEWMON 


CLD 






FA82:20 


3A 


FF 


487 






JSR 


BELL 


; CAUSES DELAY IF KEY BOUNCES 


FA85:AD 


n 


03 


488 






LDA 


SOFTEV+1 


;IS RESET HI 


FA88:49 


A5 




489 






EOR 


*SA5 


;A FUNNY COMPLEMENT OF THE 


FA8A : CD 


F4 


03 


490 






CMP 


PWREDUP 


; PWR UP BYTE ??? 


FA8D:D0 


17 


FAA6 


491 






BNE 


PWRUP 


; NO SO PWRUP 


FA8F:AD 


P2 


03 


492 






LDA 


SOFTEV 


; YES SEE IF COLD START 


FA92:D0 


3B 


FACF 


493 






BNE 


NOFIX 


; HAS BEEN DONE YET? 


FA94 : A9 


BO 




494 






LDA 


0SEO 


; DOES SEV POINT AT BASIC? 


FA96:CD 


F3 


03 


495 






CMP 


SOFTEV+I 




FA99:D0 


V. 


FACF 


496 






BNE 


NOFIX 


; YES SO REENTER SYSTEM 


FA9B:A0 


03 




497 


FIXSEV 


LDY 


#1 


; NO SO POINT AT WARM START 


FA9D:8C 


F2 


03 


498 






STY 


SOFTEV 


; FOR NEXT RESET 


FAA0:4C 


00 


F,i» 


499 






JMP 


BASIC 


; AND DO THE COLD START 


FAA3: 






500 


* 










FAA3:20 


3A 


FF 


501 


BEEPFIX 


JSR 


BELL 


;Beep on powerup 


FAA6: 






502 


* 










FAA6 : 20 


CA 


FC 


503 


PWRUP 


JSR 


COLDSTART 


;Trash memory, init ports 


FAA9: 




FAA9 


504 


SETPG3 


EQU 


* 


; SET PAGE 3 VECTORS 


FAA9:A2 


05 




505 






LDX 


#5 




FAAB.-BD 


PC 


FA 


506 


SETPLP 


LDA 


PWRC0N-1.X 


; WITH CNTRL B ADRS 


FAAE:9D 


FF 


03 


507 






STA 


BRKV-l.X 


; OF CURRENT BASIC 


FAB1:CA 






508 






DEX 






FAB2 : DO 


P7 


FAAB 


509 






BNE 


SETPLP 




FAB4 : A9 


C6 




510 






LDA 


#$C6 


; LOAD HI SLOT +1 


FAB6:80 


5A 


FB12 


511 






BRA 


PWRUP 2 


; branch around mnemonics 


FAB8: 






512 


* 










FAB8: 






513 


« 


Extension to 


MNEML (left 


mnemonics) 


FAB 8: 






514 


* 










FAB6:8A 






515 






DFB 


$8A 


;PHY 


FAB9:8B 






516 






DFB 


S8B 


;PLY 


FABA:A5 






517 






DFB 


SA5 


;STZ 


FABB:AC 






518 






DFB 


SAC 


;TRB 


FABC:00 






519 






DFB 


soo 


;??? 


FABD: 






520 


« 










FABD: 






521 


* 


This extensi 


-m to the monitor reset routine (SFA62) 


FABD: 






522 


* 


checks 


for a 


pple keys. 


If both are pressed, it goes 


FABD: 






523 


* 


into an exerciser mode. 


If the open apple key only is 


FABD: 






524 


* 


pressed, memory is selectively trashed and a cold start 



196 



Appendix I: Firmware Listings 



FABD 
FABD 
FABD 
FABF 
FAC2 
FAC5 
FAC8 
FACA 
FACC 
FACF 
FACF 
FAD2 
PAD 2: 
FAD7: 
FAD7: 
FADA: 
FADC: 
FADE: 
FAEO: 
FAE2: 
FAE4: 
FAE6: 
FAE9i 
FAEC: 
FAEF: 
FAF1: 
FAF4: 
FAF6: 
FAF8: 
FAF8: 
FAF8: 
FAF8: 
FAF9: 
FAFA: 
FAFB: 
FAFC: 
FAFD: 
FAFD: 
FAFF: 
FB02: 
FB02: 
FB05: 
FB06: 
FB08: 
FB09: 
FB09: 
FBI 1 : 
FB12: 
FB12: 
FB14: 
FB16: 
FB19: 
FB1C: 
FB1D: 
FB1E: 
FB1E: 
FB21: 
FB23: 



A9 FF 
8D FB 04 
OE 62 CO 
2C 61 CO 
10 64 
90 D7 
AC 7C C7 

6C F2 03 



CI D8 D9 DO 



FB2E 
FAA3 



20 8E FD 
A9 45 
85 40 
A9 00 
85 41 
A2 FB 
A9 AO 
20 ED FD 
BD D7 F9 
20 ED FD 
A9 BD 
20 ED FD 
B5 4A 
80 OA 



FBf>2 



74 
74 
76 
C6 
00 

59 FA 
00 EO 45 

20 DA FD 

E8 

30 DC FAE4 

60 

CI FO FO EC 
C4 

86 00 
B5 01 
20 60 FB 
6C 00 00 
00 
00 

4C DE C7 
AO 00 

EA 



525 * Is done. 

526 * 

527 RESET. X LDA 

528 STA 
ASL 
BIT 
BPL 
BCC 
JMP 



529 
530 
531 
532 
533 

534 * 

535 NOFIX 

536 * 

537 RTBL 

538 * 

539 REGDSP 

540 RGDSP1 
541 

542 

543 

544 

545 RDSP1 

546 

547 

548 

549 

550 

551 

552 

553 * 

554 

555 

556 

557 

558 

559 

560 

561 * 

562 PWRCON 
563 

564 * 

565 RCDSP2 
566 

567 
568 

569 * 

570 TITLE 
571 

572 * 

573 PWRUP2 
574 

575 
576 
577 
578 

579 * 

580 PREAD 
581 

582 



JMP 

ASC 

JSR 
LDA 
STA 
LDA 
STA 
LDX 
LDA 
JSR 
LDA 
JSR 
LDA 
JSR 
LDA 
BRA 



OSFF 

VMODE 

BUTN1 

BUTNO 

RTS2D 

BEEPFIX 

BANGER 

(SOFTEV) 

'AXYPS' 

CROUT 

#$45 

A3L 

«»$00 

A3H 

#$FB 

flSAO 

COUT 

RTBL-251.X 

COUT 

*SBD 

COUT 

ACC+5.X 

RGDSP2 



;lnlclalize node 



;open apple only, reboot 
;both apples, exercise 'er 



; DISPLAY USER REG CONTENTS 
;UITH LABELS 



;make room for mnemonics 
Right half of new mnemonics. Indexed from MNEMR 



DFB 
DFB 
DFB 
DFB 
DFB 

DW 

DFB 

JSR 
INX 

BMI 
RTS 

ASC 
DFB 

STX 
STA 

JSR 
JMP 
BRK 
BRK 

JMP 
LDY 
NOP 



$74 
$74 
S76 
$C6 
$00 

OLDBRK 

$00,$E0,S45 

PRBYTE 
RDSP1 



'Apple 
$C4 

LOCO 
LOCI 
APPLE I I 
(LOCO) 



;PHY 
;PLY 
;STZ 
;TRB 
;??? 



M PADDLE 
#$00 



;optlonal filler 

; SETPG3 MUST RETURN X=0 

; SET PTR H 
; Display our banner... 
;JUMP SC600 



; read mouse paddle 
;INIT COUNT 
; COMPENSATE FOR 1ST COUNT 



Appendix I: Firmware Listings 



197 



FB24:EA 




583 




NOP 






FB25:BD 64 


CO 


584 


PREAD2 


LDA 


PADDLO.X 


;COUNT Y-REG EVERY 12 USEC 


FB28:10 04 


FB2E 


585 




BPL 


RTS 2D 




FB2A:C8 




586 




INY 






FB2B:D0 F8 


FB25 


587 




BNE 


PRF.AD2 


;EXIT AT 255 MAX 


FB2D:88 




588 




DEY 






FB2E:60 




589 


RTS2D 


RTS 






FB2F: 




33 




INCLUDE AUT0ST2 





1981 Appendix I: Firmware Listings 



FB2F: 


2 * 








FB2F:A9 00 


3 INIT 


LDA 


#$00 


;CLR STATUS FOR DEBUC SOFTWARE 


FB31:85 48 


4 


STA 


STATUS 




FB33:AD 56 CO 


5 


LDA 


LORES 




FB36:AD 54 CO 


6 


LDA 


TXTPAGE1 


;INIT VIDEO MODE 


FB39:AD 51 CO 


7 SETTXT 


LDA 


TXTSET 


;SET FOR TEXT MODE 


FB3C:A9 00 


8 


LDA 


#$00 


;FULL SCREEN WINDOW 


FB3E:F0 OB FB4B 


9 


BEO 


SETWND 




FB40:AD 50 CO 


10 SETCR 


LDA 


TXTCLR 


;SET FOR GRAPHICS MODE 


FB43:AD 53 CO 


11 


LDA 


MIXSET 


; LOWER 4 LINES AS TEXT WINDOW 


FB46:20 36 F8 


12 


JSR 


CLRTOP 




FB49:A9 14 


13 


LDA 


#514 




FB4B:85 22 


14 SETWND 


STA 


WNDTOP 


;SET WINDOW 


FB4D:EA 


15 


NOP 






FB4E:EA 


16 


NOP 






FB4F:20 OA CE 


17 


JSR 


WNDREST 


;40/80 column width 


FB52:80 05 FB59 


IB 


BRA 


VTAB23 




FB54: 


19 * 








FB54:09 80 


20 DOCTL 


ORA 


#580 


;controls need high bit 


FB56:4C 54 CD 


21 


JMP 


CTLCHARO 


;execute control char 


FB59: 


22 * 








FB59:A9 17 


23 VTAB23 


LDA 


#$17 


;VTAB TO ROW 23 


FB5B:85 25 


24 TABV 


STA 


CV 


;VTABS TO ROW IN A-RF-G 


FB5D:4C 22 PC 


25 


JMP 


VTAB 


; don't set OURCV! t 


FB60: 


26 * 








FB60:20 58 FC 


27 APPLEII 


JSR 


HOME 


; CLEAR THE SCRN 


FB63:AO 09 


28 


LDY 


#9 




FB65:B9 02 FD 


29 STITLE 


LDA 


APPLE2C-1.Y 


;GET A CHAR 


FB68:99 OD 04 


30 


STA 


LINE1+13.Y 


;PUT IT AT TOP CENTER OF SCREEN 


FB6B:88 


J] 


DEY 






FB6C:D0 F7 FB65 


3 2 


BNE 


STITLE 




FB6E:60 


33 


RTS 






FB6F: 


34 * 








FB6F:AD F3 03 


35 SETPWRC 


LDA 


SOFTEV+I 


; ROUTINE TO CALCULATE THE 'FUNNY 


FB72:49 A5 


36 


EOR 


ff$A5 


; COMPLEMENT' FOR THE RESET VECTOR 


FB74:8D F4 03 


37 


STA 


PWREDUP 




FB77:60 


38 


RTS 






FB78: 


39 * 








FB78: FB78 


40 VIDWAIT 


EQU 


* 


;CHECK FOR A PAUSE (CONTROL-S). 


FB78:C9 8D 


41 


CMP 


#S8D 


-.ONLY WHEN I HAVE A CR 


FB7A:D0 18 FB94 


■" 2 


BNE 


NOWAIT 


;NOT SO, DO REGULAR 


FB7C:AC 00 CO 




LDY 


KBD 


;IS KEY PRESSED? 


FB7F:10 13 FB94 


44 


BPL 


NOWAIT 


;N0. 


FB81:C0 93 


45 


CPY 


#$93 


;YES — IS IT CTRL-S? 


FB83:D0 OF FB94 


46 


BNE 


NOWAIT 


;N0PE - IGNORE 


FB85:2C 10 CO 


47 


BIT 


KBDSTRB 


; CLEAR STROBE 


FB88:AC 00 CO 


48 KBDWAIT 


LDY 


KBD 


;WAIT TILL NEXT KEY TO RESUME 


FB8B: 10 FB FB88 


49 


BPL 


KBDWAIT 


;WAIT FOR KEYPRESS 


FB8D:C0 83 


50 


CPY 


#583 


;IS IT CONTROL-C? 


Ffl8F:F0 03 FB94 


51 


BEO 


NOWAIT 


;YES. SO LEAVE IT 


FB91:2C 10 CO 


52 


BIT 


KBDSTRB 


;CLR STROBE 


FB94:2C 7B 06 


53 NOWAIT 


BIT 


VFACTV 


; is video firmware active? 


FB97:30 64 FBFD 


54 


BM1 


VIDOUT 


;->no, do normal 40 column 


FB99:89 60 


55 


BIT 


#$60 


; is it a control? 


FB9B:F0 B7 FB54 


56 


BEO 


DOCTL 


;=>yes, do It 


FB9D:20 B8 C3 


57 


JSR 


STORCH 


;prlnt w/inverse mask 


FBAO:EE 7B 05 


58 NEWADV 


INC 


OURCH 


; advance cursor 


FBA3:AD 7B 05 


59 


LDA 


OURCH 


; and update others 



Appendix I: Firmware Listings 



199 



FBA6:2C IF 


CO 


60 


BIT 


RD80VID 


;but only If not 80 columns 




FBA9:30 05 


FBBO 


61 


BMI 


NEWADV1 


;->80 columns, leav'em 




FBAB:8D 7B 


04 


62 


STA 


OLDCH 






FBAE:85 24 




63 


STA 


CH 






FBB0:80 46 


FBF8 


64 NEWADV1 


BRA 


ADV2 


;check for CR 




FBB2: 




65 * 










FBB2:EA 




66 


NOP 








FBB3: 




67 * 










FBB3:06 




68 FSVERS^ 


DFB 


G00DF8 


;//e, chels TD byte 




FBB4: 




69 * 










FBB4:10 06 


FBBC 


70 D0C0UT1 


BPL 


DCX 


;->vldeo firmware active, no 


mask 


FBB6:C9 A0 




71 


CMP 


#$A0 


;ls It control char? 




FBB8:90 02 


FB8C 


72 


BCC 


DCX 


;=>yes, no mask 




FBBA:25 32 




73 


AND 


INVFLG 


;else apply inverse mask 




FBBC:4C F6 


FD 


74 DCX 


JMP 


COUTZ 


;and print character 




FBBF:00 




75 


BRK 








FBCO: 




76 * 










FBCO:00 




77 


DFB 


soo 


;chels ID byte 




FBC1: 




78 * 










FBC1:48 




79 BASCALC 


PHA 




;CALC BASE ADDR IN BASL.H 




FBC2:4A 




80 


LSR 


A 


;FOR GIVEN LINE NO. 




FBC3:29 03 




81 


AND 


#$03 


; OOLINE NO.<=$17 




FBC5:09 04 




82 


ORA 


#$04 


;ARG-000ABCDE, GENERATE 




FBC7:85 29 




83 


STA 


BASH 


; BASH-000001CD 




FBC9:68 




84 


PLA 




; AND 




FBCA:29 18 




85 


AND 


#$18 


; BASL-EABABOOO 




FBCC:90 02 


FBDO 


86 


BCC 


BASCLC2 






FBCE:69 7F 




87 


ADC 


#$7F 






FBD0:85 28 




88 BASCLC2 


STA 


BASL 






FBD2:0A 




89 


ASL 


A 






FBD3 : OA 




90 


ASL 


A 






FBD4:05 28 




91 


ORA 


BASL 






FBD6:85 28 




92 


STA 


BASL 






FBD8:60 




93 


RTS 








FBD9: 




94 * 










FBD9:C9 87 




95 CHKBELL 


CMP 


#$87 


;BELL CHAR? (CONTROL-C) 




FBDB:D0 12 


FBEF 


96 


BNE 


RTS2B 


; NO, RETURN. 




FBDD:A9 40 




97 BELLI 


LDA 


#$40 


; YES... 




FBDF:20 A8 


re 


98 


JSR 


WAIT 


; DELAY .01 SECONDS 




FBE2:A0 CO 




99 


LDY 


#$C0 






FBE4:A9 OC 




100 BELL2 


LDA 


ff$OC 


; TOGGLE SPEAKER AT 1 KHZ 




FBE6:20 A8 


re 


101 


JSR 


WAIT 


; FOR .1 SEC. 




FBE9:AD 30 


CO 


102 


LDA 


SPKR 






FBEC:88 




103 


DEY 








FBED:DO F5 


FBE4 


104 


BNE 


BELL2 






FBEF:60 




105 RTS2B 


RTS 








FBFO: 




106 * 










FBF0:A4 24 




107 STORADV 


LDY 


CH 


;get 40 column position 




FBF2:9l 28 




108 


STA 


(BASL).Y 


;and store 




FBF4:E6 24 




109 ADVANCE 


INC 


CH 


; Increment cursor 




FBF6:A5 24 




110 


LDA 


CH 






PBF8:C5 21 




111 ADV2 


CMP 


WNDWDTH 


; BEYOND WINDOW WIDTH? 




FBFA:BO 66 


FC62 


112 


BC5 


CR 


; YES, CR TO NEXT LINE. 




FBFC:60 




113 RTS3 


RTS 




; NO, RETURN. 




FBFD: 




114 * 










FBFD-.C9 AO 




115 VIDOUT 


CMP 


#$A0 


; CONTROL CHAR? 




FBFF:BO EF 


FBFO 


116 


BCS 


STORADV 


; NO, OUTPUT IT. 




FC01:A8 




117 


TAY 




; INVERSE VIDEO? 





200 



Appendix I: Firmware Listings 



I 



FC02 

FC04 

FC06 

FC08 

FCOA 

FCOC 

FCOE 

FCIO 

FC13 

FC15 

FC17 

FC1A 

FC1C: 

FC1E 

FC20 

FC22 

FC22: 

PC24: 

FC27: 

FC29j 

FC2C: 

FC2E; 

FC2F: 

FC30: 

FC32: 

FC34: 

FC35: 

FC35: 

FC35: 

FC35: 

FC35; 

FC35: 

FC36; 

FC38: 

FC3B: 

FC3D: 

FC3E: 

FC40: 

FC41: 

FC41: 

FC42: 

FC42: 

FC44: 

FC46: 

FC47: 

FC4A: 

FC4D: 

FC4F: 

FC50: 

FC51: 

FC53: 

PC55: 

FC57: 

FC58: 

FC58: 

FC5B: 

FC5D: 

FC5D: 



FBFG 



FC73 



FC66 



FBD9 



10 EC 
C9 8D 
:F0 6B 
:C9 8A 
FO 5A 
C9 88 
DO C9 
:20 E2 FE 
10 E7 FBFC 
A5 21 
20 EB FF. 
A5 22 
C5 25 

BO DC FBFC 
C6 25 

80 62 FC86 

20 CI FB 

A5 20 

2C IF CO 

10 02 

4A 

18 

65 28 

85 28 

60 



FC30 



98 

A2 16 

DD FE FE 

FO 43 FC80 

CA 

10 F8 FC38 

60 



00 

80 19 

A5 25 

48 

20 24 FC 

20 9E FC 

AO 00 

68 

1A 

C5 23 

90 Fl 

BO CB 

00 



FC5D 



FC46 
FC22 



1 18 BPL 

119 VID0UT1 CMP 

120 BEQ 

121 CMP 

122 BEO 

123 CMP 

124 BN'E 

125 BS JSR 

126 BPL 

127 LDA 

128 JSR 

129 UP LDA 

130 CMP 

131 BCS 

132 DEC 

133 * 

134 VTAB BRA 

135 VTABZ JSR 

1 36 LDA 

137 BIT 

138 BPL 

139 LSR 

140 CLC 

141 VTAB40 ADC 

142 STA 

143 RTS4 RTS 

144 * 

145 * NEWOPS transl- 

146 * to a mnemonic 

147 * If Y la not a 

148 * 

149 NEWOPS 
150 
151 NEW0P1 



STORADV 

#S8D 

NEWCR 

AS8A 

LF 

#$88 

CHKBELL 

DECCH 

RTS 3 

WNDWDTH 

WDTHCH 

WNDTOP 

CV 

RTS 3 

CV 

NEWVTAR 

BASCALC 

WNDLFT 

RD80VID 

VTAB40 

A 

BASL 
BASL 



; YES, OUTPUT IT. 

;CR? 
;Yes, use new routine 

;LINE FEED? 

; IF SO, DO IT. 

;BACK SPACE? (CONTROL-H) 

; NO, CHECK FOR BELL. 

;decrement all cursor H indlcet 

;IF POSITIVE, OK; ELSE MOVE UP, 
;get window width, 
;and set CH's to WNDWDTH- 1 

; CURSOR V INDEX 

;top line, exit 

; not top, go up one 

;go update OURCV 
-.calculate the base addresB 
;get the left window edge 
;80 columns? 
;->no, left edge ok 
jdlvlde width by 2 
'.prepare to add 
;add width to base 



ites the opcode In the Y register 
table Index and returns with Z»l. 
new opcode, Z"0. 



20 A5 CD 

BO E7 FC44 

20 9D CC 



152 

153 

154 

155 

156 * 

157 

158 * 

159 CLREOP 

160 CLREOP 2 

161 CLEOPl 
162 

163 
164 
165 
166 
167 
168 
169 
170 

171 * 

172 HOME 
173 

174 * 

175 CLRE0P1 



TYA 
LDX 
CMP 
BEQ 
DEX 
BPL 
RTS 

BRK 

BRA 
LDA 
PHA 
JSR 
JSR 
LDY 
PLA 
INC 
CMP 
BCC 
BCS 
BRK 

JSR 
BRA 



#NUMOPS 
OPTBL.X 
GETINDX 

NEWOP1 



CLREOP 1 
CV 

VTABZ 

CLEOLZ 

*$00 

A 

WNDBTM 
CLEOPl 
VTAB 



HOMECUR 
CLREOP2 



JSR GETC1IR 



;get the opcode 

; check through new opcodes 

;does it match? 

;=>yes, get new Index 

;else check next one 
;not found, exit with BNE 



;ESC F IS CLR TO END OF PACE 

;SAVE CURRENT LINE NO. ON STACK 
;CALC BASE ADDRESS 
; CLEAR TO EOL. (SETS CARRY) 
; CLEAR FROM H INDEX=0 FOR REST 

; INCREMENT CURRENT LINE NO. 

;DONE TO BOTTOM OF WINDOW? 
; NO, KEEP CLEARING LINES. 
; YES, TAB TO CURRENT LINE 



;move cursor home 

;then clear to end of page 

;load Y with proper CH 



Appendix I; Firmware Listings 



201 



FC60:8O E2 


FC44 


176 


BRA 


CLRE0P2 


;before clearing page 


FC62: 




177 * 








FC62:80 OF 


FC73 


178 CR 


BRA 


NEWCR 


;only LF If not Pascal 


FC64:00 




179 


BRK 






FC65:00 




180 


BRK 






FC66: 




181 * 








FC66:E6 25 




182 LF 


INC 


cv 


;INCR CURSOR V. (DOWN 1 LINE) 


FC68:A5 25 




183 


LDA 


cv 




FC6A:C5 23 




184 


CMP 


WNDBTM 


;OFF SCREEN? 


FC6C:90 1A 


FC88 


185 


BCC 


NEWVTABZ 


;set base+WNDLFT 


FC6E:C6 25 




186 


DEC 


CV 


;DECR CURSOR V. (BACK TO BOTTOM) 


FC70: 




187 * 








FC70:4C 35 


CB 


188 SCROLL 


.IMP 


SCROLLUP 


; scroll the screen 


FC73: 




189 * 








FC73:20 E9 


FE 


190 NEWCR 


JSR 


CLRCH 


;set CH's to 


FC76:2C FB 


04 


191 


BIT 


VHODE 


;ls it Pascal? 


FC79:10 OA 


FC85 


192 


BPL 


CRRTS 


;pascal, no LF 


FC7B:20 44 


FD 


193 


JSR 


NOES CAPE 


;else clear escape mode 


FC7E:80 E6 


FC66 


194 


BRA 


LF 


;then do LF 


FC80: 




195 * 








FC80:BD 15 


n 


196 GETINDX 


LDA 


INDX.X 


; lookup index for mnemonic 


FC83:A0 00 




197 


LDY 


#0 


;exit with BEO 


FC85:60 




198 CRRTS 


RTS 






FC86: 




199 * 








FC86:A5 25 




200 NEWVTAB 


LDA 


CV 


;update //e CV 


FC88:8D FB 


05 


201 NEWVTABZ 


STA 


OURCV 




FC8B:80 97 


FC24 


202 


BRA 


VTABZ 


;and calc base+UNDLFT 


FC8D: 




203 * 








FC8D:20 9D 


cc 


204 NEWCLREOL JSR 


GETCUR 


;get current cursor 


FC90:A9 AO 




205 NEWCLEOLZ 


LDA 


ffSAO 


;get a blank 


FC92:2C 7B 


06 


206 


BIT 


VFACTV 


;lf video firmware active. 


FC95:30 02 


FC99 


207 


BMI 


NEWC1 


;=>don't use inverse mask 


FC97:25 32 




208 


AND 


INVFLG 




FC?9:4C C2 


CB 


209 NEWC1 


JMP 


DOCLR 


;go do clear 


FC9C: 




210 * 








FC9C:80 EF 


FC8D 


211 CLREOL 


BRA 


NEWCLREOL 


;get cursor and clear 


FC9E:80 FO 


FC90 


212 CLEOLZ 


BRA 


NEWCLEOLZ 


; clear from Y 


FCAO: 




213 * 








FCAO--AO 00 




214 CLRLIN 


LOY 


*0 


;clear entire line 


FCA2:80 EC 


FC90 


215 


BRA 


NEWCLEOLZ 




FCA4 : 




216 * 








FCA4:7C 2A 


CD 


217 CTLDO 


JMP 


(CTLADR.X) 


;jump to proper routine 


FCA7: 




218 * 








PCA7:EA 




219 


NOP 






FCA8: 




220 * 








FCA8:38 




221 WAIT 


SEC 






FCA9 : 48 




222 WAIT 2 


PHA 






FCAA:E9 01 




223 WAIT3 


SBC 


#$01 




FCAC:D0 FC 


FCAA 


224 


BNE 


WAIT3 


; 1.0204 USEC 


FCAE:68 




225 


PLA 




;(13+2712*A+512*A*A) 


FCAF:E9 01 




226 


SBC 


ffSOl 




FCB1:D0 F6 


FCA9 


227 


BNE 


WATT2 




FCB3:60 




228 RTS6 


RTS 






FCB4: 




229 * 








FCB4:E6 42 




230 NXTA4 


INC 


A4L 


;INCR 2-BYTE A4 


FCB6:D0 02 


FCBA 


231 


BNE 


NXTA1 


; AND Al 


FCB8:E6 43 




232 


INC 


A4H 




FCBA:A5 3C 




233 NXTA1 


LDA 


AIL 


;INCR 2-BYTE Al. 



202 



Appendix I: Firmware Listings 



FCBC 

FCBE 

PCCO 

FCC2 

FCC4 

FCC6 

FCC8 

FCC9 

FCC9 

FCCA 

FCCA 

FCCC 

FCCE 

FCDO 

FCD2 

FCDA 

FCD6 

FCD7 

FCD9 

FCDA 

FCDC 

FCDE: 

FCDE: 

FCE1: 

FCE4: 

FCE5; 

FCF.7: 

FCEA: 

FCEC: 

FCEF: 

FCFO: 

FCF2: 

FCF4: 

FCF6: 

FCF9: 

FCFA: 

FCFC: 

FCFF: 

FD02: 

FD03: 

FD03: 

FD03; 

FDOC: 

FDOC: 

FDOE: 

FDIO: 

FDll: 

FD12: 

FD13: 

FD14: 

FD15: 

FDI6: 

FD17: 

FD18: 

FDI8: 

FD1B: 

FD1B: 

FD1D: 



F-'CCS 



:C5 3E 

:A5 3D 

:E5 3F 

:E6 3C 

:DO 02 

:E6 3D 
:60 

:60 

:A0 BO 

:64 3C 

:A2 BF 

:86 3D 

:A9 AO 

:91 3C 

:88 

:91 3C 

:CA 

:E0 01 

:D0 F2 FCDO 



8D 01 
AD 55 
38 

A2 88 
BD 27 
90 OA 
DD 77 
18 

DO OA 
EO 82 
90 06 
9D 77 
CA 

DO EB 
AD 54 
8D 00 
60 



CB 



04 



04 



FCF6 

I 

FCF6 

FCFC 

I 

FCE7 



CO 
CO 



CI FO FO EC 

A4 24 

Bl 28 

EA 

EA 

HA 

EA 

EA 

BA 

Bit 

BA 

6C 36 00 



234 CMP 

235 LDA 

236 SBC 

237 INC 

238 BNE 

239 INC 

240 RTS4B RTS 

241 * 

242 HEADR RTS 

243 * 

244 COLDSTART LDY 

245 STZ 

246 LDX 

247 BLAST STX 
LDA 
STA 
DEY 
STA 
DEX 
CPX 
BNE 

* 

STA 
LDA 
SEC 
LDX 

260 C0M1 LDA 

261 BCC 

262 CMP 

263 CLC 

264 BNE 

265 CPX 

266 BCC 

267 COM2 STA 

268 DEX 

269 BNE 

270 COM3 LDA 

271 STA 

272 RTS 

273 * 

274 MSB 

275 APPLE2C ASC 

276 * 

277 RDKEY LDY 

278 LDA 



248 
249 
250 
251 
252 
253 
254 
255 
256 
257 
258 
259 



91 28 
20 4C 



CC 



279 
280 
281 
282 
283 
284 
285 
286 

287 * 

288 KEY I NO 

289 * 

290 KEY IN 
291 



A2L 

AIM 

A2H 

AIL 

RTS4B 

AlH 



*SBO 
AIL 

#SBF 
AlH 
tfSAO 
(A1L),Y 

(A1D.Y 



#1 
BLAST 

SET80COL 
TXTPACE2 



#$88 

C0MT8L-1,X 
COM2 
S477.X 

COM2 
#S82 
COM3 
5477.X 

C0M1 

TXTPACE1 

CLR80COL 



ON 

"Apple 

CH 

(BASL).Y 



; AND COMPARE TO A2 
; (CARRY SET IF >-) 



NOP 
NOP 
NOP 

NOP 
NOP 
NOP 
NOP 
NOP 

JMP (KSWL) 



;don't do It 
;let It precess down 
; stare from BFXX down 
;6tore blanks 



; back down to next page 
;stay away from stack 
;fall Into COMINIT 

;inlt ALT screen holes 

; f or serial and comra port! 



;XFER from rom 

;branch If defaults ok 

;cest for prior setup 

; branch If not valid 

;If S4F8 & S4FF = TBL values 



; move all 8. . . 

; restore switches 
;to default states 



//c" 

;get char at current position 

; for those who restore it 

;if a program controls input 

; hooks, no cursor may be displayed 



STA 
JSR 



(BASL),Y 
SHOWCUR 



;GO TO USER KEY-IN 

;erase false images 
;display true cursor 



Appendix I: Firmware Listings 



203 



FD20:20 70 CC 


292 DONXTCUR 


.ISR 


UPDATE 


look for key, blink II cursor 


FD23: 10 FB PD20 


293 


BPL 


DONXTCUR 


loop until keypress 


FD25:48 


29A GOTKEY 


PHA 




save character 


FD26:A9 08 


295 


LDA 


ffM.CTL 


were escapes enabled? 


FD28:2C FB 04 


296 


BIT 


VMODE 




FD2B:D0 ID FD4A 


297 


BNE 


N0ESC2 


=>>no, there is no escape 


FD2D:68 


298 


PLA 




yes, there may be a way out!! 


FD2E:C9 9B 


299 


CMP 


*ESC 


escape? 


FD30-.D0 06 FD38 


300 


BNE 


LOOKPICK 


=>no escape 


FD32:4C CC CC 


301 


JMP 


NEWESC 


*>go do escape sequence 


FD35: 


302 * 








FD35:4C ED CC 


303 RDCHAR 


JMP 


ESCRDKEY 


do RDKEY with escapes 


FD38: 


304 * 








FD38:2C 7B 06 


305 LOOKPICK 


BIT 


VFACTV 


only process f. arrow 


FD3B:30 07 FD44 


306 


BHI 


NOESCAPE 


if video firmware Is active 


FD3D:C9 95 


307 


CMP 


#PICK 


was it PICK? (->,CTL-U) 


FD3F:D0 03 FD44 


308 


BNE 


NOESCAPE 


no, just return 


FD41:20 ID CC 


309 


JSR 


PICKY 


yes, pick the character 


FD4A: 


310 * 








FDA A: 


311 * NOESCAPE Is used by GETCOOT coo. 


FD44: 


312 * 








FD44:48 


313 NOESCAPE 


PHA 




save it 


FD45:A9 08 


31A N0ESC1 


LDA 


#M.CTL 


disable escape sequences 


FD47:OC FB 04 


315 


TSB 


VMODE 


and enable controls 


FDAA:68 


316 N0ESC2 


PLA 




by setting M. CTL 


FDA B: 60 


317 


RTS 






FDAC: 


318 * 








FDAC:EA 


319 


NOP 






FDAD: 


320 * 








FDAD:20 A6 C3 


321 NOTCR 


JSR 


GETCOUT 


disable controls and print 


FD50:C9 88 


322 


CMP 


CS88 


;CHECK FOR EDIT KEYS 


FD52:F0 ID FD71 


323 


BEO 


BCKSPC 


; - BACKSPACE 


FD5A:C9 98 


32A 


CMP 


#398 




FD56:F0 0A FD62 


325 


BEO 


CANCEL 


; - CONTROL-X 


FD58:E0 F8 


326 


CPX 


#SF8 




FD5A:90 03 FD5F 


327 


BCC 


NOTCR 1 


; MARGIN? 


FD5C:20 3A FF 


328 


JSR 


BELL 


; YES, SOUND BELL 


FD5F:E8 


329 NOTCR 1 


INX 




; ADVANCE INPUT INDEX 


FD60:D0 13 FD75 


330 


BNE 


NXTCHAR 




FD62:A9 DC 


331 CANCEL 


LDA 


ffSDC 


; BACKSLASH AFTER CANCELLED LI 


FD6A:20 A6 C3 


332 


JSR 


GETCOUT 




FD67:20 8E FD 


333 GETLNZ 


JSR 


CROUT 


; OUTPUT 'CR' 


FD6A:A5 33 


33 A GETLN 


LDA 


PROMPT 


; OUTPUT PROMPT CHAR 


FD6C:20 ED FD 


335 


JSR 


COUT 




FD6F:A2 01 


336 GETLN 1 


LDX 


#$01 


;INIT INPUT INDEX 


FD71 :8A 


337 BCKSPC 


TXA 






FD72:FO F3 FD67 


338 


BEO 


GETLNZ 


;WILL BACKSPACE TO 


FD7A:CA 


339 


DEX 






FD75:20 ED CC 


340 NXTCHAR 


JSR 


ESCRDKEY 


;do new RDCHAR (allow escapes) 


FD78:C9 95 


3A1 


CMP 


tfPICK 


;USE SCREEN CHAR 


FD7A:D0 08 FD8A 


342 


BNE 


ADDINP 


; FOR CONTROL-U 


FD7C:20 ID CC 


343 


JSR 


PICKY 


;lift char from screen 


FD7F:EA 


344 


NOP 






FD80:EA 


345 


NOP 






FD81:EA 


346 


NOP 




;no upshifting needed 


FD82:EA 


347 


NOP 






FD83:EA 


348 


NOP 






FD8A:9D 00 02 


349 ADDINP 


STA 


IN.X 


;ADD TO INPUT BUFFER 



204 



Appendix I: Firmware Listings 



L 


FD87:C9 8D 




350 




CMP 


#$8D 








FD89:D0 C2 


FD4D 


351 




BNE 


NOTCR 






— 


FD8B:20 9C 


FC 


352 


CR0UT1 


J5R 


CLREOL 


;CLR TO EOL IF CR 






FD8E:A9 8D 




353 


CROUT 


LDA 


#$8D 








FD90:DO 5B 
FD92: 


FDED 


354 
355 


* 


BNE 


COUT 


; (ALWAYS) 






FD92:A4 3D 




356 


PRA1 


LDY 


A1H 


; PRINT CR.A1 IN HEX 






FD94:A6 3C 




357 




LDX 


AIL 








FD96:20 8E 


FSI 


358 


PRYX2 


JSR 


CROUT 








FD99:20 40 


pg 


359 




JSR 


PRNTYX 






fcl 


FD9C:A0 00 




360 




LDY 


#$00 






- 


FD9E:A9 AD 




361 




LDA 


#SAD 


;PRINT '-' 






FDA0:4C ED 


FD 


362 




JMP 


COUT 








FDA 3: 




363 


* 










__ 


FDA3:A5 3C 




364 


XAM8 


LDA 


AIL 






^*^S 


FDA5:09 07 




365 




ORA 


#S07 


;SET TO FINISH AT 






FDA7:85 3E 




366 




STA 


A2L 


; MOD 8-7 




L_ 


FDA9:A5 3D 




367 




LDA 


A1H 








FDAB:85 3F 




368 




STA 


A2H 






FDAD:A5 3C 




369 


M0D8CHK 


LDA 


AIL 








FDAF:29 07 




370 




AND 


#$07 






L_ 


FDB1:D0 03 


FDB6 


371 




BNE 


DATAOUT 








FDB3:20 92 


FD 


372 


XAM 


JSR 


PRA1 






i - ■ 


FDB6:A9 A0 




373 


DATAOUT 


LDA 


#$A0 








FDB8:20 ED 


FD 


374 




JSR 


COUT 


; OUTPUT BLANK 




Lg, 


FDBB:BI 3C 




375 




LDA 


(AIL).Y 








FDBD:20 DA 


FD 


376 




JSR 


PRBYTE 


[OUTPUT BYTE IN HEX 




— 


FDC0:20 BA 


FC 


377 




JSR 


NXTA1 








FDC3:90 E8 


FDAD 


378 




BCC 


M0D8CHK 


;NOT DONE YET. GO CHECK MOD 8 




■^ 


FDC5:60 




379 


RTS4C 


RTS 




;DONE. 






FDC6: 




380 


* 










- 


FDC6:4A 




381 


XAMPM 


LSR 


A 


[DETERMINE IF MONITOR MODE IS 






FDC7:90 EA 


FDB3 


382 




BCC 


XAM 


; EXAMINE, ADD OR SUBTRACT 




■^ 


FDC9:4A 




383 




LSR 


A 






i— i 


FDCA:4A 




384 




LSR 


A 






- 


FDCB:A5 3E 




385 




LDA 


A2L 








FDCD:90 02 


FDD1 


386 




BCC 


ADD 






1—4 


FDCF:49 FF 




387 




EOR 


#$FF 


;FORM 2'S COMPLEMENT FOR SUBTRACT. 




FDD1:65 3C 




388 


ADD 


ADC 


AIL 








FDD3:48 




389 




PHA 










FDD4:A9 BD 




390 




LDA 


#$BD 


;PRINT '■*, THEN RESULT 







FDD6:20 ED 


ro 


391 




JSR 


COUT 






- 


FDD9 : 68 
FDDA: 




392 
393 


• 


PLA 










FDDA: 48 




394 


PRBYTE 


PHA 




; PRINT BYTE AS 2 HEX DIGITS 




, 


FDDB:4A 




395 




LSR 


A 


; (DESTROYS A-REG) 




mm 


FDDC : 4A 
FDDD:4A 
FDDE:4A 




396 
397 
398 




LSR 
LSR 
LSR 


A 
A 

A 








PDDF:20 E5 


TO 


399 




JSR 


PRHEXZ 






Em 


FDE2:68 
FDE3: 




400 
401 


Ik 


PLA 










PDE3:29 OF 




402 


PRHEX 


AND 


#$0F 


; PRINT HEX DIGIT IN A-REG 






FDE5:09 BO 




403 


PRHEXZ 


ORA 


#$B0 


;LSBITS ONLY. 




1 ~ 


FDE7:C9 BA 




404 




CMP 


#$BA 








FDE9:90 02 


FDED 


405 




BCC 


COUT 






-^ 


FDEB:69 06 




406 




ADC 


#$06 






f5 


FDED: 




407 


* 


















Appendix 1: Firmware 


Listings 


1205 



FDED-.6C 36 


M 


408 COUT 


JMP 


(CSWL) 


FDFO: 




409 * 






FDFO:2C 7B 


* 


410 C0UT1 


BIT 


VFACTV 


FDP3:4C B4 


1 


411 


JMP 


D0COUT1 


FDF6:84 35 




412 COUTZ 


STY 


YSAVI 


FDF8:48 




413 


PHA 




FDF9:20 78 


'?. 


414 


JSR 


VIDWAIT 


FDFC:68 




415 


PLA 




FDFD:A4 35 




416 


LDY 


YSAVI 


FDFF:60 




417 


RTS 




FEOO: 




418 * 






FEOO:C6 34 




419 BL1 


DEC 


YSAV 


FE02:FO 9F 


FDA3 


420 


BEO 


XAM8 


FE04: 




421 * 






FE04:CA 




422 BLANK 


DEX 




FE05:DO 16 


FE1D 


423 


BNE 


SETMDZ 


FE07:C9 BA 




424 


CMP 


ffSBA 


FE09:DO BB 


FDC6 


425 


BNE 


XAMPM 


FEOB: 




426 * 






FEOB:85 31 




427 STOR 


STA 


MODE 


FE0D:A5 3E 




428 


LDA 


A2L 


FEOF:91 40 




429 


STA 


(A3D.Y 


FE11:E6 40 




430 


INC 


A3L 


FE13:D0 02 


FE17 


431 


BNE 


RTS 5 


FE15:E6 41 




432 


INC 


A3H 


FE17:60 




433 RTS5 


RTS 




FE18: 




434 * 






FE18:A4 34 




435 SETMODE 


LDY 


YSAV 


FE1A:B9 FF 


01 


436 


LDA 


IN-l.Y 


FE1D:85 31 




437 SETMDZ 


STA 


MODE 


FE1F:60 




438 


RTS 




FE20: 




439 * 






FE20:A2 01 




440 LT 


LDX 


«soi 


FE22:B5 3E 




441 LT2 


LDA 


A2L.X 


FE24:95 42 




442 


STA 


A4L.X 


FE26:95 44 




443 


STA 


A5L.X 


FE28:CA 




444 


DEX 




FE29:10 F7 


FE22 


445 


BPL 


LT2 


FE2B:60 




446 


RTS 




FE2C: 




447 * 






FE2C:Bl 3C 




448 MOVE 


LDA 


(AIL).Y 


FE2E:91 42 




449 


STA 


(A4L),Y 


FE30:20 B4 


FC 


450 


JSR 


NXTA4 


FE33:90 F7 


FE2C 


451 


BCC 


MOVE 


FE35:60 




452 


RTS 




FE36: 




453 * 






FE36:B1 3C 




454 VERIFY 


LDA 


(AIL).Y 


FE38:D1 42 




455 


CMP 


(A4L),Y 


FE3A:F0 1C 


FE58 


456 


BEQ 


VFYOK 


FE3C:20 92 


FD 


457 


JSR 


PRA1 


FE3F:B1 3C 




458 


LDA 


(AlL).Y 


FE41:20 DA 


FD 


459 


JSR 


PRBYTE 


FE44:A9 AO 




460 


LDA 


*$A0 


FE46:20 ED 


FD 


461 


JSR 


COUT 


FE49:A9 A8 




462 


LDA 


#$A8 


FE4B:20 ED 


FD 


463 


JSR 


COUT 


FE4E:B1 42 




464 


LDA 


(A4L),Y 


FE50:20 DA 


FD 


465 


JSR 


PRBYTE 



; VECTOR TO USER OUTPUT ROUTINE 

video firmware active? 

mask II mode characters 

SAVE Y-REC 

SAVE A -REG 

OUTPUT CHR AND CHECK FOR CTRL-S 

RESTORE A-REG 

AND Y-REG 

RETURN TO SENDER... 



; BLANK TO HON 

; AFTER BLANK 

;DATA STORE MODE? 

; NO; XAM, ADD, OR SUBTRACT, 

;KEEP IN STORE MODE 

; STORE AS LOW BYTE AT (A3) 

;INCR A3, RETURN. 



;SAVE CONVERTED *:' 
: »-• '.' AS MODE 



;COPY A2 (2 BYTES) TO 

; A4 AND A5 



;MOVE (Al) THRU (A2) TO (A4) 



;VERIFY (Al) THRU (A2) 
; WITH (A4) 



_ 






206 



Appendix I: Firmware Listings 



FE53:A9 


A9 




466 




LDA 


#$A9 


FE55:20 


ED 


FD 


467 




JSR 


COUT 


FE58:20 


B4 


FC 


468 


VFYOK 


JSR 


NXTA4 


PE5B:90 


D9 


FE36 


469 




BCC 


VERIFY 


FE5D:60 






470 




RTS 




FE5E: 






471 


* 






FE5E:20 


75 


ra 


472 


LIST 


JSR 


A1PC 


FE61:A9 


14 




473 




LDA 


#$14 


FE63:4B 






474 


LIST2 


PHA 




FE64:20 


DO 


F8 


475 




JSR 


INSTDSP 


FE67:20 


53 


F9 


476 




JSR 


PCADJ 


FE6A:85 


3A 




477 




STA 


PCL 


FE6C:84 


3B 




478 




STY 


PCH 


FE6E:68 






479 




PLA 




FE6F:38 






480 




SEC 




FE70:E9 


01 




481 




SBC 


#$01 


FE72:DO 


EF 


PE63 


482 




BNE 


LIST2 


FE74:60 






483 




RTS 




FE75: 






484 


* 






FE75:8A 






485 


A1PC 


TXA 




FE76:F0 


07 


FE7F 


486 




BEQ 


A1PCRTS 


FE78:B5 


3C 




487 


A1PCLP 


LDA 


A1L.X 


FE7A:95 


3A 




4B8 




STA 


PCL.X 


FE7C:CA 






489 




DEX 




FE7D:10 


F9 


FE78 


490 




BPL 


A1PCLP 


FE7F:60 






491 


A1PCRTS 


RTS 




FE80: 






492 


* 






FE80:A0 


3F 




493 


SETINV 


LDY 


#$3F 


FE82:D0 


02 


FE86 


494 




BNE 


SETIFLG 


PE84:A0 


FF 




495 


SETNORM 


LDY 


#$FF 


FE86:B4 


32 




496 


SETIFLG 


STY 


INVFLG 


FE88:60 






497 




RTS 




FE89: 






498 


* 






FE89:A9 


00 




499 


SETKBD 


LDA 


#$00 


FE8B:85 


3E 




500 


INPORT 


STA 


A2L 


FE8D:A2 


38 




501 


INPRT 


LDX 


#KSWL 


FE8F:A0 


IB 




502 




LDY 


#KEYIN 


FE91:D0 


08 


FE9B 


503 




BNE 


IOPRT 


FE93: 






504 


■ 






FE93:A9 


00 




505 


SETVID 


LDA 


#$0 


FE95:85 


3E 




506 


OUT PORT 


STA 


A2L 


FE97:A2 


36 




507 


OUTPRT 


LDX 


#CSWL 


FE99:A0 


FO 




508 




LDY 


#C0UT1 


FE9B:A5 


3E 




509 


IOPRT 


LDA 


A2L 


FE9D:29 


OF 




510 




AND 


#SOF 


FE9F:D0 


06 


FEA7 


511 




BNE 


NOTPRTO 


FEA1:C0 


IB 




512 




CPY 


#KEYIN 


FEA3:F0 


39 


FEDE 


513 




BEO 


IOPRT 1 


FEA5:80 


IB 


FEC2 


514 




BRA 


OPRTO 


PEA7:09 


CO 




515 


NOTPRTO 


ORA 


#<IOADR 


PEA9 : AO 


00 




516 




LDY 


#$00 


FEAB:94 


00 




517 


I0PRT2 


STY 


LOCO.X 


FEAD:95 


01 




518 




STA 


L0C1.X 


FEAF:60 






519 




RTS 




FEBO: 






520 


* 






FEBO:4C 


00 


BO 


521 


XBASIC 


JMP 


BASIC 


FEB3: 






522 


* 






FEB3-.4C 


03 


so 


523 


BASCONT 


JMP 


BASIC2 



;M0VE Al (2 BYTES) TO 
; PC IF SPEC'D AND 

; DISASSEMBLE 20 INSTRUCTIONS. 

-.ADJUST PC AFTER EACH INSTRUCTION. 



;NEXT OF 20 INSTRUCTIONS 



;IF USER SPECIFIED AN ADDRESS, 
; COPY IT FROM Al TO PC. 
;YEP, SO COPY IT. 



;SET FOR INVERSE VID 

; VIA C0UT1 

;SET FOR NORMAL VID 



;D0 ' IN#0* 
;D0 'IN#AREG' 



;D0 'PR#0' 
;D0 'PR#AREG* 



;not slot 
;Continue If KEYIN 



;->do PR#0 



;T0 BASIC, COLD START 
;T0 BASIC, WARM START 



Appendix I: Firmware Listings 



207 



FEB6: 






524 


* 








FEB6:20 


75 


FE 


525 


GO 


JSR 


AlPC 


;ADDR TO PC IF SPECIFIED 


FEB9:20 


3F 


FT 


526 




JSR 


RESTORE 


; RESTORE FAKE REGISTERS 


FEBC:6C 


3 A 


00 


527 




.IMP 


(PCL) 


; AND GO! 


FEBF: 






528 


1 








FEBF:4C 


07 


F,\ 


529 


REGZ 


JMP 


REGDSP 


;GO DISPLAY REGISTERS 


FEC2: 






530 


* 








FEC2:3A 






531 


OPRTO 


DEC 


A 


;Need $FF 


FEC3:8D 


FB 


07 


532 




STA 


CURSOR 


;set checkerboard cursor 


FEC6:A9 


f ; 




533 




LDA 


CSFF-M.CTL 


; reset mode 


FEC8:80 


04 


FF.CE 


534 




BRA 


DOPRO 




FECA: 






535 


* 








FECA:4C 


pa 


03 


536 


USR 


JMP 


USRADR 


;JUMP TO CONTROL-Y VECTOR IN 


FECD: 






537 


* 








FECD:60 






538 


WRITE 


RTS 




;Tape write not needed 


FECE: 






539 


* 








FECE:8D 


7B 


<h 


540 


DO PRO 


STA 


VFACTV 


; say video firmware inactive 


FEDl:8D 


OB 


CO 


541 




STA 


CLRALTCHAR 


; switch in normal char set 


FED4:0C 


f a 


;>. 


542 




TSB 


VMODE 


; don't change M.CTL 


FED7:DA 






543 




PHX 




;save X and Y 


FED8:5A 






544 




PHY 




;for rest of PRffO 


FED9:20 


CD 


CD 


545 




JSR 


CHK80 


jconvert to 40 if needed 


FEDC:7A 






546 




PLY 






FEDD:FA 






547 




PLX 






FEDE:A9 


FD 




548 


I0PRT1 


LDA 


#<C0UT1 


;set I/O page 


FEE0:80 


C9 


FEAB 


549 




BRA 


I0PRT2 


;«>go set output hook 


FEE2: 






550 


* 








FEE2: 






551 


* DECCH 


decrements the current cursor 


FEE 2: 






552 


* CLRCH 


sets a 


11 cursors to 





FEE 2: 






553 


* SETCUP 


sets 


cursors to va 


(ue in Ace. 


FEE2: 






554 


* See expLanat 


ary note with 


GETCUR 


FEE 2: 






555 


* 








FEE2:5A 






556 


DECCH 


PHY 




; (from SFC10) 


FEE3:20 


9D 


CC 


557 




JSR 


GETCUR 


;get current CH 


FEE6:88 






558 




DEY 




;decrement It 


FEE7:80 


05 


FEEE 


559 




BRA 


SETCURl 


;go update cursors 


FEE9: 






560 


* 








FEE9:A9 


ril 




561 


CLRCH 


LDA 


91 


;set all cursors to 


FEEB:3A 






562 


WDTHCH 


DEC 


A 


;dec window width (from SFC17) 


FEEC:5A 






563 


SETCUR 


PHY 




;save Y 


FEED:A8 






564 




TAY 




;need value in Y 


FEEE:20 


AD 


CC 


565 


SETCUR1 


JSR 


GETCUR2 


;save new CH 


FEFI:7A 






566 




PLY 




;restore Y 


FEF2:AD 


7R 


05 


567 




LDA 


OURCH 


;and get new CH into ace 


FEF5:60 






568 




RTS 




;(Need LDA to set flags) 


FEF6: 






569 


* 








FEF6:20 


00 


FE 


570 


CRMON 


JSR 


BL1 


; HANDLE CR AS BLANK 


FEF9:68 






571 




PLA 




; THEN POP STACK 


FEFA:68 






572 




PLA 




; AND RETURN TO MON 


FEFB:DO 


6C 


FF69 


573 




BNE 


MONZ 


; (ALWAYS) 


FEFD: 






574 


* 








FEFD:60 






575 


READ 


RTS 




;Tape read not needed 


FEFE: 






576 


* 








FEFE: 






577 


* OPTBL 


Is a t 


able containing the new opcodes that 


FEFE: 






578 


* wouldn't fit 


into the exi 


sting lookup table. 


FEFE: 






579 


* 








FEFE: 12 






580 


OPTBL 


DFB 


S12 


;ORA (ZPAG) 


FEFFtlA 






581 




DFB 


$14 


;TRB ZPAG 



208 



Appendix I: Firmware Listings 



FFOO 


1A 




582 




DFB 


SU 


;INC 


A 


FFOl 


1C 




583 




DFB 


SIC 


;TRB 


ABS 


FF02 


32 




584 




DFB 


$32 


;AND 


(ZPAC) 


FF03 


34 




585 




DFB 


S34 


;BIT 


ZPAG.X 


FF04 


3A 




586 




DFB 


S3A 


;DEC 


A 


FF05 


3C 




587 




DFB 


S3C 


;BIT 


ABS.X 


FF06 


52 




588 




DFB 


$52 


;EOR 


(ZPAG) 


FF07 


5A 




589 




DFB 


S5A 


;PHY 




FF08 


64 




590 




DFB 


S64 


;STZ 


ZPAC 


FF09 


72 




591 




DFB 


$72 


;ADC 


(ZPAG) 


FFOA 


;/. 




592 




DFB 


$74 


;STZ 


ZPAG.X 


FFOB 


7A 




593 




DFB 


$7A 


;PLY 




FFOC 


7C 




594 




DFB 


$7C 


;JMP 


(ABS.X) 


FFOD 


89 




595 




DFB 


$89 


;BIT 


IMM 


FFOE 


92 




596 




DFB 


$92 


;STA 


(ZPAG) 


FFOF 


9C 




597 




DFB 


$9C 


;STZ 


ABS 


FPIO 


9E 




598 




DFB 


$9E 


;STZ 


ABS.X 


FF11 


B2 




599 




DFB 


SB2 


;LDA 


(ZPAG) 


FF12 


D2 




600 




DFB 


$D2 


;CMP 


(ZPAG) 


FF13 


!■;■ 




601 




DFB 


$F2 


;SBC 


(ZPAG) 


FF14 


PC 




602 




DFB 


$FC 


■ ??? 


(the unknown opcode) 


FF15 




0016 


603 NUMOPS 


EOU 


*-OPTBL-l 


;nura 


>er of bytes to check 


FF15 






604 * 












FF15 






605 * 


INDX 


contains pointers 


to the ran 


'monies for each of 


FF15 






606 * 


the opcodes 


In OPTBL. 


Pointers 


rflth BIT 7 


FF15 






607 * 


set indicate 


extensions 


to MNEML 


or MNEMR. 


FF15 






608 * 












FF15 


38 




609 INDX 


DFB 


$38 






FF16 


FB 




610 




DFB 


$FB 






FF17 


17 




611 




DFB 


$37 






FF18 


FB 




612 




DFB 


$FB 






FF19 


39 




613 




DFB 


$39 






FF1A 


21 




614 




DFB 


$21 






FF1B 


36 




615 




DFB 


S36 






FF1C 


21 




616 




DFB 


$21 






FF1D 


3A 




617 




DFB 


$3A 






FF1E 


FB 




618 




DFB 


$F8 






FF1F 


FA 




619 




DFB 


$FA 






FF20 


38 




620 




DFB 


$3B 






FF21 


FA 




621 




DFB 


$FA 






FF22 


F9 




622 




DFB 


$F9 






FF23 


22 




623 




DFB 


$22 






FF24 


21 




624 




DFB 


$21 






FF25 


3C 




625 




DFB 


$3C 






FF26 


fa 




626 




DFB 


$FA 






FF27 


r'A 




627 




DFB 


$FA 






FF28 


3D 




628 




DFB 


$3D 






FF29 


3E 




629 




DFB 


$3E 






FF2A 


3F 




630 




DFB 


$3F 






FF2B 


FC 




631 




DFB 


$FC 


;??? 




FP2C 


00 




632 




BRK 








FF2D 






633 * 












FF2D 


A9 


C5 


634 PRERR 


LDA 


*$C5 


;PRINT 'ERR', THEN FALL INTO 


FF2F 


20 


ED FD 


635 




JSR 


COUT 


; FWEEPER. 


FF32 


A9 


D2 


636 




LDA 


ff$D2 






FF34 


20 


ED FD 


637 




JSR 


COUT 






FF37 


20 


ED FD 


638 




JSR 


COUT 






FF3A 






639 * 













Appendix I: Firmware Listings 



209 



FF3A 

PF3C 

FF3F 

FF3F 

FF41 

PF42 

FF44: 

FF46 

FF48 

FF49 

FF4A: 

FF4A 

FF4C: 

FF4E: 

FF50: 

FF51 

FF52: 

FF54: 

FP55: 

FF57 

FF58: 

FF59: 

FF59: 

FF5C: 

FF5F: 

FF62: 

FF65: 

FF65: 

FF66: 

FF69: 

FF6B: 

FF6D: 

FF70: 

FF73: 

FF76: 

FF78: 

FF7A: 

FF7B: 

FF7D: 

FF80: 

FF82: 

FF85: 

FF87: 

FF8A: 

FF8A; 

FF8C: 

FF8D: 

FF8E 

FF8F 

FF90 

FF91 

FF93 

FF95 

FF96 

FF98: 

FF9A: 

FF9C: 

FF9E: 



A9 87 

4C ED 

A5 48 
48 

A5 45 
A6 46 
A4 47 
28 
60 

85 45 

86 46 

84 47 
08 

68 

85 48 
BA 

86 49 
D8 

hi. i 

20 84 
20 2F 
20 93 
20 89 

D8 

20 3A 
A9 AA 
85 33 
20 67 
20 C7 
20 A7 
84 34 
A0 13 
88 

30 E8 
D9 CD 
DO F8 
20 BE 
A4 34 
4C 73 

A2 03 
OA 
OA 
OA 
OA 
OA 

26 3E 
26 3F 
CA 

10 F8 
A5 31 
DO 06 
B5 3F 
95 3D 



FD 



PE 



FF65 



FF7A 



PF90 
FFA2 



640 BELL 
641 

642 * 

643 RESTORE 
644 

645 

646 RESTR1 

647 

648 

649 

650 * 

651 SAVE 

652 SAV1 
653 

654 
655 
656 
657 
658 
659 
660 

661 * 

662 OLDRST 
663 

664 
665 

666 * 

667 MON 
668 

669 HONZ 

670 

671 

672 

673 NXTITM 

674 

675 

676 CHRSRCH 

677 

678 

679 

680 

681 

682 

683 * 

684 DIG 
685 
686 

687 

688 

689 NXTBIT 

690 

691 

692 

693 

694 NXTBAS 

695 

696 

697 



LDA 
JMP 

LDA 
PHA 
LDA 
LDX 
LDY 
PLP 
RTS 

STA 
STX 
STY 
PHP 
PLA 
STA 
TSX 
STX 
CLD 
RTS 

JSR 
JSR 
JSR 
JSR 

CLD 
JSR 
LDA 
STA 
JSR 
JSR 
JSR 
STY 
LDY 
DEY 
BMI 
CMP 
BNE 
JSR 
LDY 
JMP 

LDX 
ASL 
ASL 
ASL 
ASL 
ASL 
ROL 
ROL 
DEX 
BPL 
LDA 
BNE 
LDA 
STA 



#$87 
COUT 

STATUS 

A5H 
XREG 

YREG 



A5H 
XREG 

YREG 



STATUS 



;MAKE A JOYFUL NOISE, THEN RETURN, 



;RESTORE 6502 REGISTER CONTENTS 
; USED BY DEBUG SOFTWARE 



;SAVE 6502 REGISTER CONTENTS 
; FOR DEBUG SOFTWARE 



SPNT 



SETNORM 
INIT 
SETVID 
SETKBD 



BELL 

#SAA 

PROMPT 

GETLNZ 

ZMODE 

GETNUM 

YSAV 

#SUBTBL-CHRTBL 

HON 

CHRTBL.Y 

CHRSRCH 

TOSUB 

YSAV 

NXTITM 

#$03 

A 

A 

A 

A 

A 

A2L 

A2H 

NXTBIT 

MODE 

NXTBS2 

A2H.X 

A1H.X 



SET SCREEN MODE 
AND INIT KBD/SCREEN 
AS I/O DEVS. 



;MUST SET HEX MODE! 

;FWEEPER. 

;•*• PROMPT FOR MONITOR 

;READ A LINE OF INPUT 
; CLEAR MONITOR MODE, SCAN IDX 
;GET ITEM, NON-HEX 
; CHAR IN A-REG. 
; X-REG-0 IF NO HEX INPUT 

COMMAND NOT FOUND, BEEP & TRY AGAIN. 

FIND COMMAND CHAR IN TABLE 

NOT THIS TIME 

GOT IT! CALL CORRESPONDING SUBROUTINE 

PROCESS NEXT ENTRY ON HIS LINE 



;GOT HEX DIGIT, 
: SHIFT INTO A2 



;LEAVE X-$FF IF DIG 



;IF MODE IS ZERO, 

; THEN COPY A2 TO Al AND A3 



Appendix I: Firmware Listings 



02 



Vb' 



FFA0:95 41 

FPA2:E8 

FFA3:F0 F3 

FFA5:DO 06 

FFA7:A2 00 

FFA9:86 3E 

FFAB:86 3F 

FFAD:B9 00 

FFB0:C8 

FFB1:20 99 C3 

FFB4:49 BO 

PFB6:C9 OA 

FFB8:90 DO 

FFBA:80 37 

FFBC:00 

FFBD:00 

FFBE: 

FFBE:A9 FE 

FFC0:48 

FFC1:B9 EO 

FFC4:48 

PFC5:A5 31 

FFC7:A0 00 

FFC9:84 31 

FFCB:60 

FFCC: 

FFCC:EA 

FFCD: 

FFCD:BC 

FFCE:B2 

FFCF:BE 

FFD0:EF 

FFD1:C4 

FFD2:A9 

FFD3:BB 

FFD4 : A6 

FFD5:A4 

FFD6:06 

FFD7:95 

FFD8:07 

FFD9:02 

FFDA:05 

PFDBrOO 

FFDC:93 

FFDD:A7 

FFDE:C6 

FFDF:99 

FFEO: 

FFEO: 

FFEO: 

FFEO: 

FFE0:B2 

FFE1:C9 

FFE2:BE 

FFE3:35 

FFE4:8C 

FFE5:96 

FFE6 : AF 



FF98 
FFAD 



FF8A 
FFF3 



698 

699 

700 

701 

702 

703 

704 

705 

706 

707 

708 

709 

710 

711 

712 

713 

714 

715 

716 

717 

718 

719 

720 

721 

722 

723 

724 

725 

726 

727 

728 

729 

730 

731 

732 

733 

734 

735 

736 

737 

738 

739 

740 

741 

742 

743 

744 

745 

746 

747 

748 

749 

750 

751 

752 

753 

754 

755 



NXTBS2 



GETNUH 



NXTCHR 



STA 
I NX 
BEQ 
8NE 
LDX 
STX 
STX 
LDA 
INT 
JSR 
EOR 
CMP 
BCC 
BRA 
BRK 
BRK 



TOSUB 



ZMOUE 



* 
CHRTBL 



NOP 

DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 



A3H.X 

NXTBAS 

NXTCHR 

#$00 

A2L 

A2H 
IN.Y 

UPSHIFTO 

#$B0 

#$0A 

DIG 

GETHEX 



#<G0 



LDA 

PHA 

LDA SUBTBL.Y 

PHA 

LDA MODE 

LDY #$00 

STY MODE 

RTS 



* 

* Table 

* dlspac 

* 

SUBTBL 



SBC 

SB2 

$BE 

SEF 

SC4 

SA9 

SBB 

SA6 

SA4 

$06 

$95 

$07 

$02 

$05 

$00 

$93 

SA7 

$C6 

$99 



; CLEAR A2 

;GET CHAR 
;upshift if necessary (set high bit) 

;it's a digit 

;check for other digits 



IDISPATCH TO SUBROUTINE, BY 

; PUSHING THE HI-ORDER SUBR ADDR, 

; THEN THE LO-ORDER SUBR ADDR 

; ONTO THE STACK, 

; (CLEARING THE MODE, SAVE THE OLD 

; MODE IN A-REC), 

; AND 'RTS' TO THE SUBROUTINE! 



;"C 
;"Y 

TE 

;v 

;~K 

;"B 
■ t_i 

■ 

;• + • 
;M 

;•<• 
;n 

;I 
JL 
;G 



;'CR 

; BLANK 



(BASIC WARM START) 
(USER VECTOR) 

(OPEN AND DISPLAY REGISTERS) 
(MEMORY VERIFY) 
(INtfSLOT) 
(PR#SLOT) 

(BASIC COLD START) 
(SUBTRACTION) 
(ADDITION) 
(MEMORY MOVE) 
(DELIMITER FOR MOVE, VFY) 
(SET NORMAL VIDEO) 
(SET INVERSE VIDEO) 
(DISASSEMBLE 20 INSTRS) 
(EXECUTE PROGRAM) 
(MEMORY FILL) 
(ADDRESS DELIMITER) 
(END OF INPUT) 



of low order monitor routine 
ch addresses. 



DFB 
DFB 
DFB 
DFB 
DFB 
DFB 
DFB 



>BASC0NT-1 

>USR-1 

>REGZ-I 

>VERIFY-1 

MNPRT-1 

>0UTPRT- 1 

>XBASIC-1 



Appendix I: Firmware Listings 



211 



FFE7:17 




756 




DFB 


>SETMODE-l 




FFE8:I7 




757 




DFB 


>SETMODE-l 




FFE9:2B 




758 




DFB 


>M0VE-1 




FFEA:1F 




759 




DFB 


>LT-1 




FFEB:83 




760 




DFB 


>SETNORM-l 




FFEC:7F 




761 




DFB 


>SETINV-1 




FFED:5D 




762 




DFB 


>LIST-1 




PFEE:B5 




763 




DFB 


>GO-l 




FFEF:17 




764 




DFB 


>SETM0DE-1 




FFF0:17 




765 




DFB 


>SETM0DE-1 




FFF1:F5 




766 




DFB 


>CRMON-l 




FFF2:03 




767 




DFB 


> BLANK- 1 




FFF3: 




768 


* 








FFF3:69 


Bfl 


769 


GETHEX 


ADC 


*S88 




FFF5:C9 


FA 


770 




CMP 


ffSFA 




FFF7:B0 


91 


FF8A 771 




BCS 


DIG 




FFF9:60 




772 




RTS 






FFFA: 




773 


* 








FFFA:FB 


03 


774 




DW 


NMI 


; NON-MASKABLE INTERRUPT VECTOR 


FFFC:62 


FA 


775 




DW 


RESET 


; RESET VECTOR 


FFFE:03 


Cfl 


776 


IRQVECT 


DW 


NEWIRQ 


; INTERRUPT REQUEST VECTOR 



212 



Appendix I: Firmware Listings 





3D 


A1H 


3C 


AIL 


FE78 


A1PCLP 


FE7F 


A1PCRTS 








FE75 


A1PC 


3F 


A2H 


3E 


A2L 


41 


A3H 






ra 


40 


A3L 


43 


A4H 


42 


A4L 


45 


A5H 






h= 


44 


A5L 


45 


ACC 


C8FF 


ACDONE 


04FF 


AC I ABU F 








C988 


ACIADONE 


C900 


ACIAINT 


C908 


AC.ATST 


FDD1 


ADD 








FD84 


ADDINP 


FBF8 


ADV2 


?FBF4 


ADVANCE 


C94B 


AIEATIT 






h 


C943 


AINOFLSH 


C94D 


A1PASS 


C922 


AIP0RT2 


C91C 


AITST2 






\-4 


C01E 


ALTCHARSET 


?03F5 


AMPERV 


FD03 


APPLE 2C 


FB60 


APPLEII 








0438 


ASTAT 


C6A2 


BADRD1 


C6D3 


BADREAD 


C77C 


BANGER 








2B 


BAS2H 


2A 


BAS2L 


FBC1 


BASCALC 


FBDO 


BASCLC2 






— 


FEB3 


BASCONT 


29 


BASH 


E003 


BASIC2 


C324 


BASICENT 






i = 


C79F 


BASICIN 


C317 


BASICINIT 


EOOO 


BASIC 


28 


BASL 








FD71 


BCKSPC 


FAA3 


BEEPFIX 


?FBDD 


BELLI 


FF3A 


BELL 






L-, 


FBE4 


BELL2 


0215 


BINH 


0214 


BINL 


C329 


B INPUT 






r^j 


PEOO 


BL1 


FE04 


BLANK 


FCDO 


BLAST 


4F 


BOOTDEV 






i = 


07DB 


BOOTS CRN 


3C 


BOOTTMP 


?C326 


BPRINT 


?FA4C 


BREAK 








03F0 


BRKV 


?FC10 


BS 


04 


BUTMODE 


C061 


BUTNO 






L_ 


C062 


BUTN1 


CFC2 


CO 3 


C307 


C3C0UT1 


7C300 


C3ENTRY 






u3 


C305 


C3KEYIN 


FD62 


CANCEL 


CA76 


CD0NE2 


CA3C 


CDONE 






i^ 


?CD7D 


CGO 


F9BA 


CHAR1 


F9B4 


CHAR2 


CDCD 


CHK80 








FBD9 


CHKBELL 


C528 


CHKMOU 


CB4E 


CHKRT 


FF7A 


CHRSRCH 






L_ 


24 


CH 


C132 


CHOK 


FFCD 


CHRTBL 


CA28 


CKDIG 






^3 


FC9E 


CLEOLZ 


FC46 


CLE0P1 


CBEE 


CLRO 


CBFC 


CLRl 






i^ 


CBF1 


CLR2 


CCO 2 


CLR3 


CBC7 


CLR40 


COOO 


CLR80COL 








COOC 


CLR80VID 


CBDA 


CLR80 


COOE 


CLRALTCHAR 


?C058 


CLRANO 






L_ 


?C05A 


CLRAN1 


?C05C 


CLRAN2 


?C05E 


CLRAN3 


FEE9 


CLRCH 






C3 


C1DD 


CLRCOL 


FC9C 


CLREOL 


FC44 


CLRE0P2 


FC42 


CLREOP 






l 


FC5D 


CLRE0P1 


CBCF 


CLRHALF 


CD9B 


CLRIT 


CC97 


CLRKBD 








FCAO 


CLRLIN 


CC04 


CLRPORT 


?CPFF 


CLRROM 


F838 


CLRSC2 






"— j 


F83C 


CLRSC3 


?F832 


CLRSCR 


F836 


CLRTOP 


CA7D 


CMDB 






1 1 


CA5D 


CMDCR 


BF 


CMDCOR 


CA79 


CMDD 


CA68 


CMDI 2 






1 


CA67 


CMDI 


CA67 


CMDK 


CA14 


CMDLOOP 


CA67 


CMDL 








C9DE 


CMDLIST 


CA5D 


CMDN 


CABO 


CMDP2 


CA78 


CMDP 






ba 


CAC4 


CMDQ 


CAB5 


CMDR 


CA99 


CMOS 


CAC6 


CMDT 






i j 


CB05 


CHDT2 


CB17 


CMDT3 


C9C7 


CMDTABLE 


CA55 


CMDZ 








CA25 


CMDZ2 


CA4D 


CMFOUND 


C555 


CMLOK 


C538 


CMLOOP 








C577 


CMNOINT 


C58E 


CMNOVBL 


C57B 


CMNOY 


C55D 


CMNTO 






~j 


C562 


CMRGHT 


C56F 


CMROK 


CA43 


CMSET 


C542 


CMXMOV 






— ^ 


CFB7 


C01 


0738 


COL 


FCCA 


COLDSTART 


30 


COLOR 








FCE7 


C0M1 


FCF6 


COM2 


FCFC 


COM3 


CA36 


COMINIT 








C9F.B 


COMMAND 


C266 


COMMPORT 


C263 


COMOUT 


C200 


COM SLOT 






r~a 


CB28 


COMTBL 


C338 


COPY ROM 


C348 


C0PYROM2 


FDF6 


COUTZ 








FDED 


COUT 


FDFO 


C0UT1 


FEF6 


CRMON 


?FD8B 


CROUT 1 








FD8E 


CROUT 


FC62 


CR 


rc*^ 


CRRTS 


37 


CSWH 








36 


CSWL 


CD2A 


CTLADR 


CD58 


CTLCHAR 


CD54 


CTLCHARO 









FCA4 


CTLDO 


CD6F 


CTLDONE 


CD71 


CTLGO 


CD80 


CTLGO 1 






^"T2 


14 


CTLNUM 


CD91 


CTLOFF 


CD95 


CTLON 


CD15 


CTLTAB 








07FB 


CURSOR 


C51D 


CVBUT 


C516 


CVMOVED 


C4ED 


CVNOVBL 








25 


CV 


FDB6 


DATAOUT 


FBBC 


DCX 


FEE2 


DECCH 








C2C8 


DEFAULT 


C2F1 


DEFCOM 


C2D9 


DEFFF 


C2FC 


DEFIDX 






LAi 


C2CE 


DEFLOOP 


C6D9 


DENIB1 


C6D7 


DENIBL 


C885 


DEVNO 








FF8A 


DIG 


CA30 


DICLOOP 


0356 


DNIBL 


CBC2 


DOCLR 








FBB4 


D0COUT1 


FB54 


DOCTL 


C6FB 


D0DRV2 


C188 


DONE 






■*"?3 


FD20 


DONXTCUR 


FECE 


DO PRO 


?C701 


DRV 2 BOOT 


C60B 


DRV2ENT 








C5C3 


DV10LOOP 


C5CA 


DV10LT 


cm 


ENTR1 


C230 


ENTR 








F8A1 


ERR 


9B 


ESC 


CCD7 


ESCO 


?CCE3 


ESC1 






■^ 


CCE5 


ESC2 


CCCO 


ESC3 


CDOC 


ESCCHAR 


0638 


ESCHAR 






g 


0013 


ESCNUM 


CCED 


ESCRDKEY 


CCF8 


ESCTAB 


C28C EXIT1 














Append 


x 1: Firmware Listings 




|213 





C28A EXITX 


?C65C 


EXTENT 


C63P EXTENT 1 


05F9 


EXTINT2 


0538 EXTINT 


F800 


F80RG 


FBB3 F8VERSI0N 


C142 


FIXCH 


?FA9B FIXSEV 


06B8 


FLAGS 


CB1B FLUSH 


F962 


FMT1 


F9A6 FMT2 


CD67 


FNDCTL 


2E FORMAT 


C64B 


FUG1 


7C648 FUGXT 


F847 


GBASCALC 


27 GBASH 


26 


GBASL 


F856 GBCALC 


C8F8 


GBEMPTY 


C8DB CBNOOVR 


C393 


GETALT 1 


C398 GETALT2 


C37C 


GETALT 


C8CC GETBUF 


C3A6 


GETCOUT 


GCA7 GETCUR1 


CC9D 


GETCUR 


CCAD GETCUR 2 


CCB7 


GETCUR3 


CCBF GETCURX 


F8A5 


GETFMT 


FFF3 GETHEX 


FC80 


GETINDX 


?FD6F CETLNl 


FD67 


GETLNZ 


7FD6A GETLN 


FFA7 


GETNUM 


CB57 GETST 


CEFA 


GETX 


7CF06 GETY 


CF38 


GKEY 


7FD25 GOTKEY 


FEB6 


GO 


C89F GOBREAK 


06 


GO0DF8 


C28F GOREMOTE 


C290 


GOTERM 


F8CC GOTONE 


2C 


H2 


C64E HANGING 


C5E3 


HDDONE 


C5BE HDLOOP 


C5B8 


HDP0S2 


?FCC9 HEADR 


C5AC 


HEXDEC2 


C59B HEXTODEC 


7C057 


HIRES 


F81C HLINE1 


?F819 


HLINE 


FC58 HOME 


CDA5 


HOMECUR 


CE1B HOOKITUP 


CE20 


HOOKUP 


F897 IEVEN 


0200 


INBUF 


CAOC INCMD 


FF15 


INDX 


?F88C INSDS2 


0200 


IN 


C405 INENT 


FB2F 


INIT 


C41C INITMOUSE 


7FF.8B 


INPORT 


FE8D INPRT 


F882 


INSDS1 


F8D0 INSTDSP 


CC12 


INVERT 


32 INVFLG 


CC1C 


INVX 


COOO IOADR 


FE9B 


IOPRT 


FEDE IOPRT1 


FEAB 


I0PRT2 


FF58 IORTS 


C058 


IOU 


C078 IOUDSBL 


C079 


IOUENBL 


C806 IRQ! 


C827 


IRQ2 


C831 IRQ3 


C83B 


IR04 


C850 IRQ5 


C85E 


IR06 


C861 IR07 


C87 3 


IRQ8 


C88C IRQDNE1 


C88F 


IRQDNE2 


C899 IRQDNE3 


C882 


IRQDONE 


703FE IROLOC 


C989 


IROTBLE 


FFFE IRQVECT 


7FA40 


IRQ 


C663 ISMRK1 


C22F 


ISRDY 


CFF9 JMPDEST 


C32C 


JPINIT 


C32F JPREAD 


C335 


J P STAT 


C332 JPWRITE 


C010 


KBDSTRB 


FB88 KBDWAIT 


COOO 


KBD 


FD1B KEY IN 


?FD18 


KEYINO 


39 KSWH 


38 


KSWL 


C08B LCBANKl 


C083 


LCBANK2 


2F LENGTH 


FC66 


LF 


0400 LINE1 


FE5E 


LIST 


FE63 LIST2 


2C 


LMNEM 


00 LOCO 


01 


LOCI 


FD38 LOOKPICK 


C056 


LORES 


FE22 LT2 


FE20 


LT 


? 40 M.40 


20 


M.CTL2 


08 M.CTL 


10 


M. CURSOR 


08 M.GOXY 


01 


M. MOUSE 


80 M.PASCAL 


04 


M.VMODE 


44 MACSTAT 


C709 


MAKTBL 


2E MASK 


C9D4 


MASK1 


C9D9 MASK2 


05P8 


MAXH 


04F8 MAXL 


077D 


MAXXH 


067D MAXXL 


707FD 


MAXYH 


?06FD MAXYL 


C400 


MBASIC 


C79B MBBAD 


0578 


MINH 


0478 MINL 


057D 


MINXH 


04 7D MINXL 


705FD 


MINYH 


704FD MINYL 


C8AB 


MIRQLP 


C8C2 MIROSTD 


C4F1 


MI STAT 


?C052 MIXCLR 


C053 


MIXSET 


F9C0 MNEML 


FAOO 


MNEMR 


F8BE MNNDX1 


P8C2 


MNNDX2 


F8C9 MKNDX3 


FDAD 


MOD8CHK 


31 MODE 


FF65 


MON 


FF69 MONZ 


067C 


MOUARM 


C063 MOUBUT 


C048 


MOUCLR 


7C058 MOUDSBL 


7C059 


MOUENBL 


07FC MOUMODE 


C4D5 


MOUSEINT 


CD9F MOUSOFF 


CD99 


MOUSON 


07 7 C MOUSTAT 


0478 


MOUTEMP 


C066 M0UX1 


057C 


MOUXH 


CO 15 MOUXINT 


047C 


MOUXL 


C067 M0UY1 


05FC 


MOUYH 


CO 1 7 MOUYINT 


04FC 


MOUYL 


20 MOVARM 


CF86 


MOVEAUX 


CF99 MOVEC2M 


C8A2 


MOVE IRQ 


CF9F MOVELOOP 


FE2C 


HOVE 


CFCB MOVERET 


CF9F 


MOVESTRT 


02 MOVMODE 


C7DE 


MP ADDLE 


C72F MSG 


CAA6 


MSLOOP 


07F8 MSLOT 


CAA4 


MSWAIT 


0300 NBUF1 


FBBO 


NEWADV1 


FBAO NEWADV 


FA47 


NEWBRK 


FC99 NEWC1 


FC90 


NEWCLEOLZ 


FC8D NEWCLREOL 


FC73 


NEUCR 


CCCC NEWESC 


C803 


NEW IRQ 


7FA81 NEWMON 


FC38 


NEWOP1 


FC35 NEWOPS 


FC86 


NEWVTAB 


FC88 NEWVTABZ 


CFA9 


NEXTA1 


03FB NMI 


CA09 


NOCMD 


C46B NOERROR 


7FD45 


NOESC 1 


FD4A NO ESC 2 


FD44 


NOE SCAPE 


C26B NOESC 


FACF 


NOFIX 



214 



Appendix I; Firmware Listings 



C725 


NOPATRN 


C371 


NOREAD 


CA93 


NOSH I FT 


C4F9 


N0STAT2 


C36A 


NOT1 


C8FE 


NOTACIA 


FD5F 


N0TCR1 


FD4D 


NOTCR 


?CC68 


NOTINV1 


CC6B 


N0TINV2 


CC53 


NOTINV 


FEA7 


NOTPRTO 


C22E 


NOTRDY 


FB94 


NOWAIT 


047F 


NUMBER 


0016 


NUMOPS 


FCBA 


NXTA1 


FCB4 


NXTA4 


FF98 


NXTBAS 


FF90 


NXTBIT 


FFA2 


NXTBS2 


FD75 


NXTCHAR 


FFAD 


NXTCHR 


7F85F 


NXTCOL 


077B 


NXTCUR 


FF73 


NXTITM 


FA59 


OLDBRK 


047B 


OLDCH 


067A 


OLDCUR2 


0679 


OLDCUR 


7FF59 


OLDRST 


FEC2 


OPRTO 


FEFE 


OPTBL 


057B 


OURCH 


05FB 


OURCV 


C407 


OUTENT 


7FE95 


OUTPORT 


FE97 


OUTPRT 


C1E4 


P1INIT 


C1F3 


P1READ2 


C1EE 


Pi READ 


C1FB 


PI STATUS 


C1F6 


P1WRITB 


C211 


P2INIT 


C213 


P2READ 


C217 


P2STATUS 


C215 


P2WRITE 


C064 


PADDLO 


CF71 


PASCALC 


7CF7F 


PASCLC2 


CCOB 


PAS INVERT 


CF35 


PASREAD 


C850 


PASSK1P1 


C97C 


PBFULL 


C973 


PBOK 


7F954 


PCADJ2 


F95C 


PCADJ 4 


F953 


PCADJ 


F956 


PCADJ 3 


3B 


PCH 


3A 


PCL 


CF19 


PCTL 


C7F6 


PDOK 


C7EB 


PDON 


CC3D 


PICK I 


CC33 


PICK2 


CC3F 


PICK3 


CC4A 


PICK4 


95 


PICK 


CC1D 


PICKY 


CF41 


PINIT 


CEBC 


PIORDY 


F800 


PLOT 


F80E 


PL0T1 


CECO 


PNOTRDY 


C402 


PNULL 


FD92 


PRA1 


F910 


PRADR1 


F914 


PRADR2 


F926 


PRADR3 


F92A 


PRADR4 


F930 


PRADR5 


F94A 


PRBL2 


7F94C 


PRBL3 


F948 


PRBLNK 


FDDA 


PRBYTE 


7FB1E 


PREAD 


FB25 


PREAD2 


?FF2D 


PRERR 


CEF7 


PRET 


7FDE3 


PRHEX 


FDE5 


PRHEXZ 


F8F5 


PRMN1 


F8F9 


PRMN2 


C168 


PRNOW 


7F941 


PRNTAX 


F8DB 


PRNTBL 


F8D4 


PRNTOP 


F940 


PRNTYX 


cue 


PRNT 


7F944 


PRNTX 


33 


PROMPT 


FD96 


PRYX2 


CF66 


PS1 


CF51 


PSETUP 


CF54 


PSETUP2 


CF30 


PSETX 


C222 


P STAT 2 


CEB1 


PSTATUS 


CEBE 


PSTERR 


7 CO 70 


PTRIG 


C967 


PUTBUF 


C7DA 


PUTINBUF 


CE3B 


PVMODE 


04 B8 


PWDTH 


CEDD 


PWR1 


FAFD 


PWRCON 


03P4 


PWREDUP 


CEF4 


PWRET 


CEC2 


PWRITE 


CEF1 


PWRITERET 


FB12 


PWRUP2 


FAA6 


PWRUP 


C506 


OLOOP 


C5E8 


QTBL 


CF.45 


OUIT 


CE44 


QX 


7 CO 60 


RD40SW 


C018 


RD80COL 


COIF 


RD80VID 


C63F 


RDADR 


C016 


RDALTZP 


C6A8 


RDATO 


C6AA 


RDAT1 


C6BA 


RDAT2 


C6BC 


RDAT3 


C6CB 


RDAT4 


C6A6 


RDATA 


COO 3 


RDCARDRAM 


7FD35 


RDCHAR 


C6A2 


RDDHDR 


C656 


RDHDO 


C65E 


RDHD1 


C667 


RDHD2 


C671 


RDHD3 


7C01D 


RDHIRES 


FDOC 


RDKEY 


con 


RDLCBNK2 


CO 12 


RDLCRAM 


C002 


RDMAINRAM 


7C01B 


RDM IX 


C01C 


RDPAGE2 


C013 


RDRAMRD 


C014 


RDRAMWRT 


C685 


RDSEC1 


C687 


RDSEC2 


C68F 


RDSEC3 


C683 


RDSECT 


FAE4 


RDSP1 


C01A 


RDTEXT 


7C019 


RDVBLBAR 


7FEFD 


READ 


FAD7 


REGDSP 


FEBF 


REGZ 


?F938 


RELADR 


FA62 


RESET 


FABD 


RESET. X 


C354 


RESETLC 


FF3F 


RESTORE 


7FF44 


RESTR1 


C641 


RETRY 1 


C657 


RETRY 


FADA 


RGDSP1 


FB02 


RGDSP2 


2D 


RMNEM 


4F 


RNDH 


4E 


RNDL 


C081 


ROMIN 


C37B 


ROMOK 


0478 


ROM STATE 


FAD2 


RTBL 


F80C 


RTHASK 


F87F 


RTMSKZ 


F831 


RTSl 


FBEF 


RTS2B 


F961 


RTS2 


FB2E 


RTS2D 


FBFC 


RTS3 


FCC8 


RTS4B 


7FDC5 


RTS4C 


7FC34 


RTS4 


FE17 


RTS5 


?FCB3 


RTS6 


7FF4C 


SAV1 


FF4A 


SAVE 


BFFB 


SCNTL 


BFFA 


SCOMD 


CE58 


SCR1 


CB5K 


SCR2 


CF.66 


SCR3 


CE79 


SCR4 


CE82 


SCR5 


CE8B 


SCR6 


CE96 


SCR7 


7CE8D 


SCR8 


CEaD 


SCR9 


CBB9 


SCRL3 


CB9B 


SCRLEVEN 


CBA2 


SCRLFT 


CB6D 


SCRL1N 


CBBO 


SCRLODD 


7F871 


SCRN 


F879 


SCRN2 


CE80 


SCRN48 


CE53 


SCRN84 


CB30 


SCROLLDN 


CB38 


SCROLI.IT 


CB35 


SCROLLUP 


7FC70 


SCROLL 


BFF8 


SDATA 


C61F 


SEEKZERO 


C296 


SERIN 


CUE 


SERISOUT 


03B8 


SERMODE 


C18C 


SEROUT 


C191 


SER0UT2 


C19D 


SER0UT3 


C117 


SERPORT 


ClOO 


SERSLOT 


CU6 


SERVID 


CDCO 


SET40 


COO I 


SET80COL 



Appendix I: Firmware Listings 



215 



CD BE 


SET80 


GOOD SET80VID 


COOF 


SETALTCHAR 


C009 


SETALTZP 


?C059 


SETANO 


?C05B SETAN1 


?C05D 


SETAN2 


C05F 


SETAN3 


C184 


SETCH 


?F864 SETCOL 


FEEE 


SETCUR1 


FEEC 


SETCUR 


CB67 


SETDBAS 


?FB40 SETGR 


CE23 


SETHOOKS 


FE86 


SETIFLG 


FE80 


SETINV 


?C454 SETIOU 


CDA1 


SET IT 


FE89 


SETKBD 


FE1D 


SETMDZ 


FE18 SETMODE 


FE84 


SETNORM 


?FAA9 


SETPG3 


FAAB 


SETPLP 


?FB6F SETPWRC 


C360 


SETROM 


CB88 


SET SRC 


C008 


SETSTDZP 


CACD SETTERM 


?FB39 


SETTXT 


C233 


SETUP 


CB83 


SETUP2 


FE93 SETVID 


FB4B 


SETWND 


CE1A 


SETX 


CBC1 


SEV1 


CC4C SHOWCUR 


C45E 


S I LOOP 


C2BE 


SINOMOD 


C205 


SIN 


C465 SINOCH 


CBA8 


SKPLFT 


CBB4 


SKPRT 


2B 


SLOTZ 


CI SLTDMY 


C46C 


SMINVALID 


C18B 


SOCMD 


C1E2 


SODONE 


03F2 SOFTEV 


C1BF 


SOMAIN 


C1A9 


SORDY 


C1C1 


S0RDY2 


C207 SOUT 


C030 


SPKR 


49 


SPNT 


BFF9 


SSTAT 


CF29 STARTXY 


48 


STATUS 


CAE6 


STCLR 


FB65 


STITLE 


?FEOB STOR 


FBFO 


STORADV 


C3B8 


STORCH 


C3DB 


STORE 1 


?C3F7 ST0RE4 


C3C1 


STORE 


C3EE 


ST0RE2 


?C3F2 


ST0RE3 


C3F9 STORE 5 


C3B3 


STORY 


CB21 


STRTS 


CAED 


STSET 


CAF6 STWASOK 


FFEO 


SUBTBL 


C246 


SUDODEF 


C25C 


SUDONE 


C249 SUNODEF 


C257 


SUOUT 


C160 


TAB 


?FB5B 


TABV 


?C020 TAPEOUT 


C740 


TBL1 


C749 


TBL2 


C71B 


TBLL00P2 


C70D TBLLOOP 


04 F8 


TEMPI 


06F8 


TEMP 


0578 


TEMPA 


05F8 TEMPY 


C293 


TERMl 


DF 


TERMCUR 


C275 


TESTKBD 


0800 THBUF 


?FB09 


TITLE 


C15E 


TOOFAR 


FFBE 


TOSUB 


06FF TRKEY 


067F 


TRSER 


05FF 


TWKEY 


057F 


TWSER 


C050 TXTCLR 


CO 54 


TXT PAGE t 


CO 55 


TXTPAGE2 


C051 


TXTSET 


05FA TYPHED 


CC91 


UD2 


C39B 


UPSHIFT 


FC1A 


UP 


CC70 UPDATE 


C399 


UPSHIFTO 


03F8 


USRADR 


FECA 


USR 


2D V2 


C070 


VBLCLR 


CO 19 


VBLINT 


oc 


VBLMODE 


FE36 VERIFY 


067B 


VFACTV 


FE58 


VFYOK 


CE31 


VIDMODE 


FC04 VIDOUTl 


FBFD 


VIDOUT 


FB78 


VIDWAIT 


F826 


VLINEZ 


F828 VLINE 


04FB 


VMODE 


FC30 


VTAB40 


FC22 


VTAB 


FB59 VTAB23 


FC24 


VTABZ 


FCA8 


WAIT 


FCA9 


WAIT2 


FCAA WAIT 3 


FEEB 


WDTHCH 


CDD5 


WINO 


CDEO 


UIN1 


CDED WIN2 


CDF2 


WIN3 


CE02 


WIN4 


CDD2 


WIN40 


CE18 WIN5 


CDD4 


WIN80 


23 


WNDBTM 


20 


WNDLFT 


CEOA WNDREST 


22 


WNDTOP 


21 


WNDWDTH 


C005 


WRCARDRAM 


?FECD WRITE 


C004 


WRMAINRAM 


CD8D 


X. CUR. OFF 


CD89 


X. CUR. ON 


CDB7 X.SI 


CDBO 


X.SO 


C3A5 


X. UPSHIFT 


FDB3 


XAM 


FDA3 XAM8 


FDC6 


XAMPM 


FEBO 


XBASIC 


C9AD 


XBITKBD 


C9C0 XBKB1 


C9C2 


XBKB2 


06FB 


XCOORD 


CFF6 


XFERAZP 


CFEO XFERC2M 


CFE6 


XFERZP 


CFCD 


XFER 


C752 


XL00P1 


C780 XMBASIC 


C78D 


XMBOUT 


C490 


XMCDONE 


C4B0 


XMCLAMP 


C484 XMCLEAR 


C59A 


XMDONE 


C473 


XMM2 


C471 


XMHLOOP 


C46D XMHOME 


C4CF 


XMINT 


C763 


XMODE 


C495 


XMREAD 


C50C XMSKIP 


C4FC 


XMTSTINT 


C9A8 


XNOKEY 


C8F0 


XNOSBUF 


91 XON 


C7 58 


XPAGE 


C4A4 


XRBUT 


C4AB 


XRBUT2 


C98F XRDKBD 


C8C5 


XRDSER 


C8FF 


XRDSNO 


46 


XREG 


C9A0 XRKBD1 


C423 


XRLOOP 


C766 


XRSET 


C76E 


XRST1 


C43D XSETMOU 


C452 


XSOFF 


?C100 


XXX 


0008 


YHI 


47 YREG 


35 


YSAV1 


34 


YSAV 


FFC7 


ZMODE 


C7FB ZZNM1 


CB24 


ZZNM2 


CE4D 


ZZQUIT 


** SUCCESSFUL ASSEMBLY :- NO ERRORS 










** ASSEMBLER CREATED ON 1 5-JAN-84 21:28 








** TOTAL LINES ASSEMBLED 4406 










** FREE SPACE PAGE 


COUNT 47 











216 



Appendix I: Firmware Listings 



r 

i 

i 

i 
i 
i 

E 





! 

L 



to 

o 
u 
w 



65C02: The microprocessor used in the Apple He computer. 

ACIA: Asynchronous Communications Interface Adapter. A 
single chip that converts data from parallel to serial form, and 
vice versa, and handles serial transmission and reception and 
RS-232-C signals, under the control of its internal registers set 
and changed by firmware or software. 

accumulator: The register in the 6502 and 65C02 
microprocessors where most computations are performed. 

acronym: A word formed from the initial letters of a name or 
phrase, such as ROM, from read-only memory. 

ADC: See analog-to-digital converter. 

address: A number used to identify something, such as a 
location in the computer's memory. 

analog: Represented in terms of a physical quantity that can 
vary smoothly and continuously over a range of values. For 
example, a conventional 12-hour clock face is an analog device 
that represents the time of day in terms of the angles of the 
clocks hands. Compare digital. 

analog-to-digital converter: A device that converts quantities 
from analog to digital form. For example, the Apple He's hand 
control converts the position of the control dial (an analog 
quantity) into a discrete number (a digital quantity) that changes 
in steps even when the dial is turned smoothly. 

AND: A logical operator that produces a true result if both of its 
operands are true, a false result if either or both of its operands 
are false; compare OR, exclusive OR, NOT. 

Apple lie: A personal computer in the Apple II family, 
manufactured and sold by Apple Computer, Inc. 



Glossary [219" 



Applesoft: An extended version of the BASIC programming 
language used with the Apple lie computer. The firmware for 
interpreting and executing programs in Applesoft is included in 
the Apple lie ROM. 

ASCII: American Standard Code for Information Interchange; a 
code in which the numbers from to 127 stand for text 
characters, used for representing text inside a computer and for 
transmitting text between computers or between a computer 
and a peripheral device. 

assembler: A language translator that converts a program 
written in assembly language into an equivalent program in 
machine language. 

assembly language: A low-level programming language in 
which individual machine-language instructions are written in a 
symbolic form more easily understood by a human programmer 
than machine language itself. 

asserted: Made true (positive in positive-true logic; negative in 
negative-true logic). 

asynchronous: Having a variable time interval between 
characters. 

back panel: The rear face of the Apple lie computer, which 
includes the power switch, the power connector, and 
connectors for two serial devices, a video display device, an 
external disk drive, and a mouse or hand control. 

bandwidth: A measure of the range of frequencies a device can 
handle. In the case of a video monitor, greater bandwidth 
enables it to display more information; to display 80 columns of 
text, a monitor should have a bandwidth of at least 12 MHz. 

base address: In indexed addressing, the fixed component of 
an address. 

baud: A unit of signaling speed equal to the number of discrete 
conditions or signal events per second. Often equated (though 
not precisely) with bits per second. 

binary: The representation of numbers in terms of powers of 
two, using the two digits and 1. Commonly used in 
computers, since the values and 1 can easily be represented 
in physical form in a variety of ways, such as the presence or 
absence of current, positive or negative voltage, or a white or 
black dot on the display screen. 



220 1 Glossary 



bit: A binary digit (0 or 1); the smallest possible unit of 
information, consisting of a simple two-way choice, such as yes 
or no, on or off, positive or negative, something or nothing. 

board: See printed-circuit board. 

boot: To start up a computer by loading a program into memory 
from an external storage medium such as a disk. Often 
accomplished by first loading a small program whose purpose 
is to read the larger program into memory. The program is said 
to pull itself up by its own bootstraps. 

bootstrap: See boot. 

BREAK: A SPACE (0) signal sent over a communication line, of 
long enough duration to interrupt the sender. This signal is 
often used to end a session with a timesharing service. 

BRK: A 65C02 instruction that causes the microprocessor to 
halt. 

buffer: An area of the computer's memory used as a holding 
area where information can be stored by one program or device 
and then read out by another at a different speed. 

bus: A group of wires that transmit related information from one 
part of a computer system to another. In the Apple lie, the 
address bus has 16 wires, and the data bus has eight. 

byte: A unit of information consisting of a fixed number of bits; 
on the Apple He, one byte consists of eight bits and can 
represent any value between and 255. 

carriage return: An ASCII character (decimal 13; Appendix H) 
that ordinarily causes a printer or display device to place the 
subsequent character on the left margin. On a manual 
typewriter, this movement is combined with line feed (the 
advancement of the paper to the next line). With computers, 
carriage return and line feed are separate, causing hair-raising 
problems for the user. 

carrier: The background signal on a communication channel 
that is modified to carry the information. Under RS-232-C rules, 
the carrier signal is equivalent to a continuous MARK (1) signal; 
a transition to then represents a start bit. 

carry flag: The C bit in the 65C02 processor status register, 
used to hold the carry bit in addition and subtraction. 



Glossary [^j 



cathode-ray tube: An electronic device, such as a television 
picture tube, that produces images on a screen coated with 
phosphors that emit light when struck by a focused beam of 
electrons. 

central processing unit: See processor. 

character: A letter, digit, punctuation mark, or other symbol 
used in printing, displaying or transferring information- 
character code: A number used to represent a text character 
for processing by a computer system. 

chip: The small piece of semiconducting material (usually 
silicon) on which an integrated circuit is fabricated. 

Clear To Send: An RS-232-C signal from a DCE to a DTE that 
is normally kept false until the DCE makes it true, indicating that 
all circuits are ready to transfer data out. 

code: (1) A number or symbol used to represent some piece of 
information in a compact or easily processed form. (2) The 
statements or instructions making up a program. 

cold start: The process of starting up the Apple lie when the 
power is first turned on (or as if the power had just been turned 
on) by loading the operating system into main memory, then 
loading and running a program. Compare warm start. 

command: A communication from the user to a computer 
system (usually typed from the keyboard) directing it to perform 
some action. 

command character: An ASCII character, usually { control H T) 
or (control X T), that causes the serial port firmware to interpret 
subsequent characters as a command. 

command register An ACIA location (at address SC09A for 
port 1 and SCOAA for port 2) that stores parity type and 
RS-232-C signal characteristics. 

communication mode: An operating state in which serial port 2 
(or t. if so set) is prepared to exchange data and signals with a 
DCE (such as a modem). 

compiler: A language translator that converts a program written 
in a high-level programming language into an equivalent 
program in some lower-level language (such as machine 
language) for later execution. Compare interpreter. 



222 1 Glossary 



composite video: A video signal that includes both display 
information and the synchronization (and other) signals needed 
to display it. 

computer: An electronic device for performing predefined 
(programmed) computations at high speed and with great 
accuracy. 

computer system: A computer and its associated hardware, 
firmware, and software. 

connector: A physical device such as a plug, socket, or jack, 
used to connect two devices to one another. 

control character: A character that controls or modifies the way 
information is printed or displayed. Control characters have 
ASCII codes between $00 and $1F (or between S80 and $9F if 
the high-order bit is set). You can generate them at the 
Apple lie keyboard by holding down ( control ) while typing one 
of the letter keys or @ C \ ] A or _. 

control register: An ACIA location (at address SC09B for port 1. 
or $C0AB for port 2) that stores data format and baud rate 
selections. 

CPU: Central processing unit; see processor. 

CRT: See cathode-ray tube. 

cursor: A symbol displayed on the screen that marks where the 
users next action will take effect or where the next character 
typed from the keyboard will appear. 

DAC: See digital-to-analog converter. 

data: Information; especially information used or operated on by 
a program. 

data bit: One of five to eight bits representing a character. 

Data Carrier Detect: An RS-232-C signal from a DCE (such as 
a modem) to a DTE (such as an Apple lie) indicating that a 
communication connection has been established. 

Data Communication Equipment: As defined by the RS-232-C 
standard, any device that transmits or receives information. 
Usually this is a modem. However, when a Modem Eliminator is 
used, the Apple lie itself looks like a DCE to the other device, 
and the other device looks like a DCE to the Apple lie. 



Glossary 1 223 



data format: The form in which data is stored, manipulated or 
transferred. Serial data transmitted and received by port 1 or 2 
has a data format of: one start bit, five to eight data bits, an 
optional parity bit, and one, one and a half, or two stop bits. 

Data Set Ready: An RS-232-C signal from a DCE to a DTE 
indicating that the DCE has established a connection. 

Data Terminal Equipment: As defined by the RS-232-C 
standard, any device that generates or absorbs information, 
thus acting as a terminus of a communication connection. 

Data Terminal Ready: An RS-232-C signal from a DTE to a 
DCE indicating a readiness to transmit or receive data. 

DCD: See Data Carrier Detect 

DCE: See Data Communication Equipment 

debug: To locate and correct an error or the cause of a 
problem or malfunction in a computer system. Typically used to 
refer to software-related problems. 

decimal: The common form of number representation used in 
everyday life, in which numbers are expressed in terms of 
powers of ten. using the ten digits to 9. 

default: A value, action, or setting that is assumed or set in the 
absence of explicit instructions otherwise. 

demodulate: To recover the information being transmitted by a 
modulated signal; for example, a conventional radio receiver 
demodulates an incoming broadcast signal to convert it into 
sound emitted by a speaker. 

device: (1) A physical apparatus for performing a particular task 
or achieving a particular purpose. (2) In particular, a hardware 
component of a computer system. 

digit: (1) One of the characters to 9. used to express numbers 
in decimal form. (2) One of the characters used to express 
numbers in some other form, such as and 1 in binary or 
to 9 and A to F in hexadecimal. 

digital: Represented in a discrete (noncontinuous) form, such as 
numerical digits. For example, contemporary digital clocks 
display the time in numerical form (such as 2:57) instead of 
using the positions of a pair of hands on a clock face. Compare 
analog 



"2241 Glossary 



digital-to-analog converter: A device that converts quantities 
from digital to analog form. 

DIP: See dual in-line package. 

disassembler: A language translator that converts a 
machine-language program into an equivalent program in 
assembly language, more easily understood by a human 
programmer. The opposite of an assembler. 

disk: An information storage medium consisting of a flat, 
circular magnetic surface on which information can be recorded 
in the form of small magnetized spots, similarly to the way 
sounds are recorded on tape. 

disk drive: A device that writes and reads information on the 
surface of a magnetic disk. 

diskette: A term sometimes used for the small (5-1/4-inch) 
flexible disks used with the Apple Disk II drive. 

Disk II drive: A model of disk drive made and sold by Apple 
Computer for use with the Apple lie computer; uses 5-1/4-inch 
flexible (floppy) disks. 

Disk Operating System: An optional software system for the 
Apple He that enables the computer to control and communicate 
with one or more Disk II drives. 

display: (1) Information exhibited visually, especially on the 
screen of a display device. (2) To exhibit information visually. 
(3) A display device. 

display device: A device that exhibits information visually, such 
as a television receiver or video monitor. 

display screen: The glass or plastic panel on the front of a 
display device, on which images are displayed. 

DOS: See Disk Operating System 

DSR: See Data Set Ready. 

DTE: See Data Terminal Equipment. 

DTR: See Data Terminal Ready. 

dual in-line package: An integrated circuit packaged in a 
narrow rectangular box with a row of metal pins along each 
side; similar in appearance to an armored centipede. 

echo: To send an input character to a video display, printer, or 
other output device. 



Glossary 1 225 



edit: To change or modify; for example, to insert, remove, 
replace, or move text in a document. 

editor: A program that enables the user to create and edit 
information of a particular form; for example, a text editor or a 
graphics editor. 

effective address: In machine-language programming, the 
address of the memory location on which a particular instruction 
actually operates, which may be arrived at by indexed 
addressing or some other addressing method. 

emulation mode: A manner of operating in which one computer 
or interface imitates another. 

even parity: Use of an extra bit set to or 1 as necessary to 
make the total number of 1 bits (among the data bits plus the 
parity bit) an even number. 

error message: A message displayed or printed to notify the 
user of an error or problem in the execution of a program. 

escape mode: A state of the Apple lie computer, entered by 
pressing the fiscl key, in which certain keys on the keyboard 
take on special meanings for positioning the cursor and 
controlling the display of text on the screen. 

escape sequence: A sequence of keystrokes, beginning with 
(Iscl , used for positioning the cursor and controlling the display 
of text on the screen. 

exclusive OR: A logical operator that produces a true result if 
one of its operands is true and the other false, a false result if 
its operands are both true or both false; compare OR, AND, 
NOT. 

execute: To perform or carry out a specified action or 
sequence of actions, such as those described by a program. 

firmware: Software stored permanently in hardware: programs 
in read-only memory (ROM). Such programs (for example, the 
Applesoft interpreter and the Apple lie Monitor program) are 
built into the computer at the factory; they can be executed at 
any time but cannot be modified or erased from main memory. 
Compare hardware, software. 

fixed-point: A method of representing numbers inside the 
computer in which the decimal point (more correctly, the binary 
point) is considered to occur at a fixed position within the 



226 1 Glossary 



number. Typically, the point is considered to lie at the right end 
of the number, so that the number is interpreted as an integer. 
Compare floating-point. 

flexible disk: A disk made of flexible plastic; often called a 
floppy disk. Compare rigid disk. 

floating-point: A method of representing numbers inside the 
computer in which the decimal point (more correctly, the binary 
point) is permitted to float to different positions within the 
number. Some of the bits within the number itself are used to 
keep track of the point's position. Compare fixed-point. 

form feed: An ASCII character (decimal 12; Appendix H) that 
causes a printer or other paper-handling device to advance to 
the top of the next page. 

framing error: In serial data transfer, absence of the expected 
stop bit(s) at the end of a received character. The serial port 1 
and 2 ACIAs record this error by setting bit 1 (FRM) of its 
status register to 1. The ACIA checks and records each framing 
error separately; if the next character is OK, the FRM bit is 
cleared. 

full duplex: Capable of simultaneous two-way communication. 

graphics: (1) Information presented in the form of pictures or 
images. (2) The display of pictures or images on a computer's 
display screen. Compare text. 

half duplex: Capable of communication in one direction at a 
time. 

hand control: An optional peripheral device that can be 
connected to the Apple lie's hand control connector and has a 
rotating dial and a pushbutton; typically used to control 
game-playing programs, but can be used in more serious 
applications as well. 

hand control connector: A 9-pin connector on the Apple lie's 
back panel, used for connecting hand controls to the computer. 

hardware: Those components of a computer system consisting 
of physical (electronic or mechanical) devices. Compare 
software, firmware. 



Glossary 1 227 



hertz: The unit of frequency of vibration or oscillation, also 
called cycles per second; named for the physicist Heinrich Hertz 
and abbreviated Hz. The Apple lie's 65C02 microprocessor 
operates at a clock frequency of 1 million hertz, or 1 megahertz 
(MHz). 

hexadecimal: The representation of numbers in terms of 
powers of sixteen, using the sixteen digits to 9 and A to F. 
Hexadecimal numbers are easier for humans to read and 
understand than binary numbers, but can be converted easily 
and directly to binary form; each hexadecimal digit corresponds 
to a sequence of four binary digits, or bits. 

high-level language: A programming language that is relatively 
easy for humans to understand. A single statement in a 
high-level language typically corresponds to several instructions 
of machine language. 

high-order byte: The more significant half of a memory address 
or other two-byte quantity. In the Apple lie's 65C02 
microprocessor, the low-order byte of an address is usually 
stored first and the high-order byte second. 

high-resolution graphics: The display of graphics on the 
Apple He's display screen as a six-color array of points, 
280 columns wide and 192 rows high. 

hold time: In computer circuits, the amount of time a signal 
must remain valid after some related signal has been turned off; 
compare setup time. 

Hz: See hertz. 

IC: See integrated circuit. 

index: (1) A number used to identify a member of a list or table 
by its sequential position. (2) A list or table whose entries are 
identified by sequential position. (3) In machine-language 
programming, the variable component of an indexed address, 
contained in an index register and added to the base address to 
form the effective address. 

indexed addressing: A method of specifying memory addresses 
used in machine-language programming. 

index register: A register in a computer processor that holds an 
index for use in indexed addressing. The Apple He's 65C02 
microprocessor has two index registers, called the X register 
and the Y register. 



228 1 Glossary 



input: (1) Information transferred into a computer from some 
external source, such as the keyboard, a disk drive, or a 
modem. (2) The act or process of transferring such information. 

instruction: A unit of a machine-language or assembly-language 
program corresponding to a single action for the computer's 
processor to perform. 

integer: A whole number, with no fractional part; represented 
inside the computer in fixed-point form. 

integrated circuit: An electronic component consisting of many 
circuit elements fabricated on a single piece of semiconducting 
material, such as silicon; see chip. 

interface: The devices, rules, or conventions by which one 
component of a system communicates with another. 

interpreter: A language translator that reads a program written 
in a particular programming language and immediately carries 
out the actions that the program describes. Compare compiler. 

interrupt: A temporary suspension in the execution of a 
program by a computer in order to perform some other task, 
typically in response to a signal from a peripheral device or 
other source external to the computer. 

inverse video: The display of text on the computer's display 
screen in the form of black dots on a white (or other single 
phosphor color) background, instead of the usual white dots on 
a black background. 

I/O: Input/output; the transfer of information into and out of a 
computer. See input, output. 

I/O device: Input/output device; a device that transfers 
information into or out of a computer. See input, output, 
peripheral device. 

I/O link: A fixed location that contains the address of an 
input/output subroutine in the Apple He Monitor program. 

K: Two to the tenth power, or 1024 (from the Greek root kilo, 
meaning one thousand); for example, 64K equals 64 times 
1024, or 65.536. 

keyboard: The set of keys built into the Apple lie computer, 
similar to a typewriter keyboard, for typing information to the 
computer. 



Glossary 1 229 



keystroke: The act of pressing a single key or a combination of 
keys (such as f control K c")) on the Apple lie keyboard. 

kilobyte: A unit of information consisting of 1K (1024) bytes, or 
8K (8192) bits; see K. 

KSW: The symbolic name of the location in the Apple lie's 
memory where the standard input link is stored; stands for 
keyboard switch. See I/O link. 

language: See programming language. 

language translator: A system program that reads a program 
written in a particular programming language and either 
executes it directly or converts it into some other language 
(such as machine language) for later execution. See interpreter, 
compiler, assembler 

least significant bit: The right-hand bit of a binary number as 
written down; its positional value is or 1. 

line feed: An ASCII character (decimal 10; Appendix H) that 
ordinarily causes a printer or video display to advance to the 
next line. 

load: To transfer information from a peripheral storage medium 
(such as a disk) into main memory for use; for example, to 
transfer a program into memory for execution. 

local: Nearby; capable of direct connection using wires only. 

location: See memory location. 

logical operator: An operator, such as AND. that combines 
logical values to produce a logical result. 

low-level language: A programming language that is relatively 
close to the form that the computers processor can execute 
directly. Low-level languages available for the Apple lie include 
65C02 machine language and 65C02 assembly language. 

low-order byte: The less significant half of a memory address 
or other two-byte quantity. In the Apple He's 65C02 
microprocessor, the low-order byte of an address is usually 
stored first and the high-order byte second. 

low-power Schottky: A type of TTL integrated circuit having 
lower power and higher speed than a conventional TTL 
integrated circuit. 



230 1 Glossary 



-*4 



tow-resolution graphics: The display of graphics on the 
Apple He's display screen as a sixteen-color array of blocks. 
40 columns wide and 48 rows high. 

machine language: The form in which instructions to a 
computer are stored in memory for direct execution by the 
computer's processor. Each model of computer processor (such 
as the 65C02 microprocessor used in the Apple lie) has its own 
form of machine language. 

main memory: The memory component of a computer system 
that is built into the computer itself and whose contents are 
directly accessible to the processor. 

MARK parity: A bit of value 1 appended to a binary number for 
transmission. The receiving device can then check for errors by 
looking for this value on each character. 

memory: A hardware component of a computer system that can 
store information for later retrieval; see main memory, 
random-access memory, read-only memory, read-write 
memory. 

memory location: A unit of main memory that is identified by an 
address and can hold a single item of information of a fixed 
size: in the Apple He. a memory location holds one byte, or 
eight bits, of information. 

MHz: Megahertz; one million hertz. See hertz. 

microcomputer: A computer, such as the Apple He, whose 
processor is a microprocessor. 

microprocessor: A computer processor contained in a single 
integrated circuit, such as the 65C02 microprocessor used in 
the Apple He. 

microsecond: One millionth of a second; abbreviated us. 

millisecond: One thousandth of a second; abbreviated ms. 

mode: A state of a computer or system that determines its 
behavior. 

modem: Modulator/demodulator; a peripheral device that 
enables the computer to transmit and receive information over a 
telephone line; a DCE that connects a DTE to communication 
lines. 

modem eliminator: The physical crossing of wires that replaces 
a pair of modems for direct connection of two DTEs. 



Glossary 1231 



modulate: To modify or alter a signal so as to transmit 
information; for example, conventional broadcast radio transmits 
sound by modulating the amplitude (amplitude modulation, 
or AM) or the frequency (frequency modulation, or FM) of a 
carrier signal. 

monitor: See video monitor. 

Monitor program: A system program built into the Apple He in 
firmware, used for directly inspecting or changing the contents 
of main memory and for operating the computer at the 
machine-language level. 

most significant bit: The leftmost bit of a binary number as 
written down. This bit represents or 1 times 2 to the power 
one less than the total number of bits in the binary number. For 
example, in the binary number 10000. which contains five digits, 
the / represents 1 times two to the fourth power — or sixteen. 

nanosecond: One billionth (in British usage, one 
thousand-millionth) of a second; abbreviated ns. 

network: A collection of interconnected, individually controlled 
computers, together with the hardware and software used to 
connect them. 

nibble: A unit of information equal to half a byte, or four bits; 
can hold any value from to 15. Sometimes spelled nybble. 

NOT: A unary logical operator that produces a true result if its 
operand is false, a false result if its operand is true; compare 
AND, OR, exclusive OR. 

NTSC: (1) National Television Standards Committee; the 
committee that defined the standard format used for 
transmitting broadcast video signals in the United States. 
(2) The standard video format defined by the NTSC. 

object code: See object program. 

object program: The translated form of a program produced by 
a language translator such as a compiler or assembler; also 
called object code. Compare source program. 

odd parity: Use of an extra bit set to or 1 as necessary to 
make the total number of 1 bits an odd number. 

opcode: See operation code. 

operand: A value to which an operator is applied; the value on 
which an opcode operates. 



232 1 Glossary 



operating system: A software system that organizes the 
computers resources and capabilities and makes them available 
to the user or to application programs running on the computer. 

operation code: The part of a machine-language instruction that 
specifies the operation to be performed; often called opcode. 

operator: A symbol or sequence of characters, such as + or 
AND. specifying an operation to be performed on one or more 
values (the operands) to produce a result. 

OR: A logical operator that produces a true result if either or 
both of its operands are true, a false result if both of its 
operands are false; compare exclusive OR, AND, NOT. 

output: Information transferred from a computer to some 
external destination, such as the display screen, a disk drive, a 
printer, or a modem. 

overrun: A condition that occurs when the Apple lie processor 
does not retrieve a received character from the ACIAs receive 
data register before the subsequent character arrives. The ACIA 
automatically sets bit 2 (OVR) of its status register; subsequent 
characters are lost. The receive data register contains the last 
valid data word received. 

page: (1) A screenful of information on a video display, 
consisting on the Apple He of 24 lines of 40 or 80 characters 
each. (2) An area of main memory containing text or graphical 
information being displayed on the screen. (3) A segment of 
main memory 256 bytes long and beginning at an address that 
is an even multiple of 256 bytes. 

page zero: See zero page. 

parallel interface: An interface in which many bits of 
information (typically eight bits, or one byte) are transmitted 
simultaneously over different wires or channels. Compare serial 
interface. 

parity: Maintenance of a sameness of level or count, usually the 
count of 1 bits in each character, for error checking. 

parity error: Absence of the correct parity bit value in a received 
character. The serial port ACIAs record this error by setting 
bit (PAR) of their status registers to 1. 

PC board: See printed-circuit board. 



Glossary (233 



phase: (1) A stage in a periodic process; a point in a cycle; for 
example, the 65C02 microprocessor uses a clock cycle 
consisting of two phases called PHIO and PHIL {2) The 
relationship between two periodic signals or processes; for 
example, in NTSC color video, the color of a point on the 
screen is expressed by the instantaneous phase of the video 
signal relative to the color reference signal. 

pipelining: A feature of a processor that enables it to begin 
fetching the next instruction before it has finished executing the 
current instruction. All other things equal, processors that have 
this feature run faster than those without it. 

pointer: An item of information consisting of the memory 
address of some other item. 

pop: To remove the top entry from a stack. 

port: The point of connection, usually a physical connector, 
between a computer and a peripheral device, another computer, 
or a network. 

power supply: The hardware component of a computer that 
draws electrical power from a power outlet and converts it to 
the forms needed by some other hardware component. 

printed-circuit board: A hardware component of a computer or 
other electronic device, consisting of a flat, rectangular piece of 
rigid material, commonly fiberglass, from which all conducting 
material except the desired circuits is etched, and to which 
integrated circuits and other electronic components are 
connected. 

processor: The hardware component of a computer that 
performs the actual computation by directly executing 
instructions represented in machine language and stored in 
main memory. 

program: (1) A set of instructions describing actions for a 
computer to perform in order to accomplish some task, 
conforming to the rules and conventions of a particular 
programming language. (2) To write a program. 

programming language: A set of rules or conventions for 
writing programs. 

prompt: To remind or signal the user that some action is 
expected, typically by displaying a distinctive symbol, a 
reminder message, or a menu of choices on the display screen. 



234 1 Glossary 



prompt character: A text character displayed on the screen to 
prompt the user for some action. Often also identifies the 
program or component of the system that is doing the 
prompting; for example, the prompt character ] is used by the 
Applesoft BASIC interpreter, > by Integer BASIC, and * by the 
system Monitor program. 

prompt message: A message displayed on the screen to 
prompt the user for some action. 

protocol: A predefined exchange of control sighals between 
devices enabling them to prepare for and carry out coordinated 
data transfers. 

push: To add an entry to the top of a stack. 

radio-frequency modulator: A device for converting the video 
signals produced by a computer to a form that can be accepted 
by a television receiver. 

RAM: See random-access memory. 

random-access memory: Memory in which the contents of 
individual locations can be referred to in an arbitrary or random 
order. 

raster: The pattern of parallel lines making up the image on a 
video display screen. The image is produced by controlling the 
brightness of successive dots on the individual lines of the 
raster. 

read: To transfer information into the computer s memory from 
a source external to the computer (such as a disk drive or 
modem) or into the computer's processor from a source 
external to the processor (such as the keyboard or main 
memory). 

read-only memory: Memory whose contents can be read but 
not written; used for storing firmware. Information is written into 
read-only memory once, during manufacture; it then remains 
there permanently, even when the computer's power is turned 
off. and can never be erased or changed. Compare read-write 
memory, random-access memory, write-only memory. 

read-write memory: Memory whose contents can be both read 
and written; often misleadingly called random-access memory. 
or RAM. The information contained in read-write memory is 
erased when the computer's power is turned off, and is 



Glossary 1 235 



permanently lost unless it has been saved on a more permanent 
storage medium, such as a disk. Compare read-only memory, 
random-access memory, write-only memory. 

receive data register: A read-only register in each serial port 
ACIA (at location SC098 for port 1 and SC0A8 for port 2) that 
stores the most recent character successfully received. 

register: A location in a computer processor where an item of 
information, such as a byte, is held and modified under program 
control. Registers in the 65C02 microprocessor include the 
accumulator (A), two index registers (X and Y), the stack 
pointer (S), the processor status register (P). and the program 
counter (PC). The PC register holds two bytes (sixteen bits); the 
other registers hold one byte (eight bits) each. 

remote: Too distant for direct connection using wires or cables 
only. 

Request To Send: An RS-232-C signal from a DTE to a DCE to 
prepare the DCE for data transmission. 

return address: The point in a program to which control returns 
on completion of a subroutine. 

RF modulator: See radio-frequency modulator. 

Rl: See Ring Indicator. 

rigid disk: A disk made of a hard, nonflexible material. Compare 
flexible disk. 

Ring Indicator: An optional RS-232-C signal from a DCE to a 
DTE that indicates the arrival of a call. 

ROM: See read-only memory. 

routine: A part of a program that accomplishes some task 
subordinate to the overall task of the program. 

RS-232-C: A standard created by the Electronic Industries 
Association (EIA) to allow devices of different manufacturers to 
exchange serial data— particularly via telephone lines. 

RTS: See Request To Send. 

run: (1) To execute a program. (2) To load a program into main 
memory from a peripheral storage medium, such as a disk, and 
execute it. 

save: To transfer information from main memory to a peripheral 
storage medium for later use. 



236 1 Glossary 



L 

' 




L 


screen: See display screen. 


E 


scroll: To change the contents of all or part of the display 
screen by shiftirg information out at one end (most often the 
top) to make room for new information appearing at the other 
end (most often the bottom), producing an effect like that of 
moving a scroll of paper past a fixed viewing window. See 
viewport, window. 


£ 


serial interface: An interface in which information is transmitted 
sequentially, one bit at a time, over a single wire or channel. 
Compare parallel interface 


£ 


setup time: The amount of time a signal must be valid in 
advance of some event; compare hold time. 


c 


silicon: A non-metallic, semiconducting chemical element from 
which integrated circuits are made. 


b 


soft switch: A means of changing some feature of the Apple He 
from within a program; specifically, a location in memory that 
produces some special effect whenever its contents are read or 

written. 


h 


software: Those components of a computer system consisting 
of programs that determine or control the behavior of the 
computer. Compare hardware, firmware. 


=sa 


source code: See source program. 


J 


source program: The original form of a program given to a 
language translator such as a compiler or assembler for 
conversion into another form; sometimes called source code. 
Compare object program. 


~ 


space character: A text character whose printed representation 
is a blank space, typed from the keyboard by pressing the 
SPACE bar. 


LZ 


SPACE parity: A bit of value appended to a binary number for 
transmission. The receiving device can look for this value on 
each character as a means of error checking. 


5 


stack: A list in which entries are added or removed at one end 
only (the top of the stack), causing them to be removed in LIFO 

(last-in-first-out) order. 




start bit: A transition from a MARK signal to a SPACE signal 
for one bit-time, indicating that the next string of bits represents 
a character. 




Glossary 1 237 



status register: A register in an ACIA (at location SC099 for 
port 1 and SC0A9 for port 2) that stores the state of two of the 
RS-232-C signals and the state of the transmit and receive data 
registers, as well as the outcome of the most recent character 
transfer. 

stop bit: A MARK signal following a string of data bits (or their 
optional parity bit) to indicate the end of a character. 

string: An item of information consisting of a sequence of text 
characters. 

strobe: (1) An event, such as a change in a signal, that triggers 
some action. (2) A signal whose change is used to trigger some 
action. 

subroutine: A part of a program that can be executed on 
request from any point in the program, and which returns 
control to the point of the request on completion. 

television receiver: A display device capable of receiving 
broadcast video signals (such as commercial television) by 
means of an antenna. Can be used in combination with a 
radio-frequency modulator as a display device for the Apple lie 
computer. Compare video monitor. 

television set: See television receiver. 

terminal: A device consisting of a typewriterlike keyboard and a 
display device, used for communicating between a computer 
system and a human user. Personal computers such as the 
Apple lie typically have all or part of a terminal built into them. 

terminal mode: An operating state of the Apple He 
communication port in which the firmware makes the computer 
act like a simple ASCII terminal. 

text: (1) Information presented in the form of characters 
readable by humans. (2) The display of characters on the 
Apple He's display screen. Compare graphics. 

text window: An area on the Apple He's display screen within 
which text is displayed and scrolled. 

transistor-to-transistor logic: (1) A family of integrated circuits 
used in computers and related devices. (2) A standard for 
interconnecting such circuits that defines the voltages used to 
represent logical zeros and ones. 



238 1 Glossary 



transmit data register: A write-only register in one of the serial 
port ACIAs (at location SC098 for port 1 and SC0A8 for port 2) 
that holds the current character to be transmitted. 

troubleshoot: To locate and correct the cause of a problem or 
malfunction in a computer system. Typically used to refer to 
hardware-related problems; compare debug. 

TTL: See transistor-to-transistor logic. 

unary operator: An operator that applies to a single operand; 
for example, the minus sign (-) in a negative number such 
as -6 is a unary arithmetic operator. 

user: The person operating or controlling a computer system. 

user interface: The rules and conventions by which a computer 
system communicates with the person operating it. 

vector: (1) The starting address of a program segment, when 
used as a common point for transferring control from other 
programs. (2) A memory location used to hold a vector, or the 
address of such a location. 

video: (1) A medium for transmitting information in the form of 
images to be displayed on the screen of a cathode-ray tube. 
(2) Information organized or transmitted in video form. 

video monitor: A display device capable of receiving video 
signals by direct connection only, and which cannot receive 
broadcast signals such as commercial television. Can be 
connected directly to the Apple He computer as a display 
device. Compare television receiver. 

viewport: All or part of the display screen, used by an 
application program to display a portion of the information (such 
as a document, picture, or worksheet) that the program is 
working on. Compare window. 

warm start: The process of restarting the Apple lie after the 
power is already on. without reloading the operating system into 
main memory and often without losing the program or 
information already in main memory. Compare cold start. 

window: The portion of a collection of information (such as a 
document, picture, or worksheet) that is visible in a viewport on 
the display screen; compare viewport. 

word: A group of bits of a fixed size that is treated as a unit; 
the number of bits in a word is a characteristic of each 
particular computer. 



Glossary 1 239 



wraparound: The automatic continuation of text from the end of 
one line to the beginning of the next, as on the display screen 
or a printer. 

write: To transfer information from the computer to a 
destination external to the computer (such as a disk drive, 
printer, or modem) or from the computer's processor to a 
destination external to the processor {such as main memory). 

X register: One of the index registers in the 65C02 
microprocessor. 

Y register: One of the index registers in the 65C02 
microprocessor. 

zero page: The first page {256 bytes) of the Apple lie's 
memory, also called page zero. Since the high-order byte of any 
address in this page is zero, only the low-order byte is needed 
to specify a zero-page address; this makes zero-page locations 
more efficient to address, in both time and space, than 
locations in any other page of memory. 



240 1 Glossary 



i 
I 



— * 

O 

CO 

-1 
V 
n 



Apple II Monitors Peeled. Cupertino. Calif.: Apple Computer. 
Inc., 1978. 

Currently not updated for Apple lie and lie. but a good 
introduction to Apple II series input/output procedures; 
also useful for historical background. 

Apple lie Design Guidelines. Cupertino. Calif.: Apple Computer. 
Inc.. 1982. 

Addendum to the Design Guidelines. Cupertino, Calif.: Apple 
Computer. Inc.. 1984. 

Apple He Reference Manual. Cupertino, Calif.: Apple Computer, 
Inc.. 1982. 

Applesoft BASIC Programmer's Reference Manual, Volumes 1 
and 2. For the Apple II, lie, and lie. Cupertino, Calif.: 
Apple Computer, Inc.. 1982. 

The version that applies to both the Apple lie and the 
Apple He has Apple product number A2L0084 (Vol. 1) and 
A2L0085 (Vol.2). 

Applesoft Tutorial. Cupertino, Calif.: Apple Computer, Inc., 1982. 

Leventhal, Lance. 6502 Assembly Language Programming. 
Berkeley. Calif.: Osborne/McGraw-Hill. 1979. 



Bibliography 1 243 



Synertek Hardware Manual. Santa Clara, Calif.: Synertek 
Incorporated. 1976. 

Does not contain instructions new to 65C02, but is the 
only currently available manufacturer's hardware manual 
for 6500 series microcomputers. 

Synertek Programming Manual. Santa Clara, Calif.: Synertek, 
Incorporated, 1976. 

The only currently available manufacturer's programming 
manual for 6500 series microcomputers. 

Watson. Allen. III. "A Simplified Theory of Video Graphics, 
Part I." Byte Vol. 5, No. 11 (November, 1980). 

— . "A Simplified Theory of Video Graphics. Part II." Byte 
Vol. 5, No. 12 (December, 1980). 

. "More Colors for Your Apple." Byte Vol. 4, No. 6 (June, 
1979). 

. "True Sixteen-Color Hi-Res." Apple Orchard Vol. 5, 
No. 1 (January, 1984). 

Wozniak, Steve: "System Description: The Apple II." Byte Vol. 2, 
No. 5 (May. 1977). 



244 1 Bibliography 









I 




u 






L 








£-4 




3 




L 




Q. 




: 8 




CD 




L 




X 




t3 








L. 








t? 








L 








p 










References to entries in Volume 2 are 


in square brackets [ ]. 




1 - 


Cast of Characters 


Apple II series differences [60-78] 




p 
p 


' (asterisk) 179 

(backslash) 59 
_ (blinking underscore cursor) 154 
> (greater than sign) 59 
? {question mark) 58, 59 
] (right bracket) 59 


Apple He 

block diagram 210 

care of 205-206 

differences from Apple lie [61-78] 

expansion 2 
Apple Me ROMs [72] 
Applesoft <S commands 52 




A 


Applesoft BASIC 59, [16-18, 40] 






BASIC interpreter 24 






A register 17 


Applesoft interpreter 21,224-225 




■ J 


accumulator 17 


arithmetic, hexadecimal 193 






ACIA 134. 148, 253-262. (63| 


ASCII |71. 83. 86-87) 




p 


block diagram 255 


character set 79, (97, 114-122] 




interrupts |60| 


assemblers 199 






address bus 12, 213 


assembly language, and mouse 171 




H^^^_-. 


AKD 218-219 


asterisk (*) 179 




■ ? 


ALTCHAR 104-105. 218. |73| 


automatic line feed 131, 145 






alternate character set 68. |73] 


automatic repeat 3 






ALT2P 25, 26, 216. [46] 


Autostart ROM [69] 




5-* 


analog inputs 176, [68| 


auxiliary memory screen holes 






annunciator outputs |76| 


135-136, 149-150 




M 


ANSI [84] 


See also screen holes 




any-key-down 79, 229 


auxiliary RAM 20 




"" 


flag [66] 


AUXMOVE See MOVEAUX 




i * 


Apple Extended 80-Column 


AY-3600-type keyboard decoder 229 




Text Card [67, 74] 








Apple Language Card [64] 






| 4 








r 


Index 


1 247 





B 

B command 131, 144 
back panel 8, 9 
backslash (\) 59. 62 
backspace 62 
bank 25 

bank-switched memory 22, (64, 69] 
BANK2 216 

BASIC 130. 163, 175-177, 179, 180, 
192, [114) 

and assembly language support 171 

and hand controls 173 

and mouse 163, 172 
BASICS disk (39, 69] 
baud rate 137, 258 
BCLK 256 
BELL 84 
BELLI 84 
BIT instruction |3] 
bits (103| 

blanking intervals 233 
blinking underscore cursor (_) 154 
block diagrams 

ACIA 255 

Apple lie 210 
BREAK 132. 137, 145 
break instructions [48] 
BREAK signal [75] 
BRK 75, 189, (43] 
buffer 59 

serial I/O (75) 
built-in diagnostics [62] 
built-in disk drive 8 
built-in self-tests [65] 
button interrupt mode 164. 167 
bypassing firmware [58-60] 
byte(s) [103, 104] 

power-up 51 



C06X 267 
C07X 217 
C3COUT1 55, 64 



C3KEYIN 55 

CALL statement 179 

Canadian keyboard [91] 

cancel line 62 

f caps-lock) 4, 79, [84] 

card(s) [74, 75] 

care of computer 205-206 

carriage return 139, 152 

carrier 137 

CAS (column-address strobe) 228 

cassette input and output [67-68, 77] 

certifications [99] 

CH (cursor horizontal) 63 

changing memory contents 184 

changing registers 190 

character(s) 

flashing 68 

generator 241 

inverse 68 

normal 68 

sets [71.73] 
chips, custom [78] 
clamping boundaries 171 
CLAMPMOUSE 168 
CLEARMOUSE 168 
CLEOLZ 116 
clock 211 

master 213 

system 213 
CLREOL 116 
CLREOP 116 
CLRSCR 117 
CLRTOP 117 

code conversions [114-122] 
cold-start procedure 49. 50 
colors 

high-resolution 243 

low-resolution 242, [63] 
command character 146, [75] 
command register 134, 148, 260 
Communication Card [74] 
communication port 141 
comparing data in memory 188-189 



248 



Index 





connector(s) 


custom chips [78) 


L 


back panel 8-9 


custom integrated circuits 215-223 


t$ 


game [76] 


CV 63 




power 207 




L 


serial port 257 


D 


f» 


CONTINUE BASIC command 192 




(control) 4, 79, 229 


D command 131. 144 




transferring 42-43 
control characters 64 


data, transferring 41-42 


ta 


data bits 137 


r* 


control register 134, 148, 258-259 
CONTROL-A. as command character 


data bus 213 




Data Carrier Detect [60] 


bs 


143 


data format 137, 138, 144, 151 


r 


{ control Kef) 1 53 1 


data inputs 21 

Data Set Ready See DSR 




{ CONTROL HTT) 62 


ti 


CONTROL-I, as command character 


Data Terminal Ready See DTR 


^* 


130, 132 


DCB 261 




CONTROL-K, as command character 


DCD [60] 


tj 


193 


decimal, negative [107] 


^* 


■"control"'-, p". 56. 126. 142 


device signature 72 




as command character 193 


DEVNO [21] 

DHIRES 49, 104, 106, 107, 166 


si 


( CONTROL H~R~) 155 




(controlXE) |53] 

( control HT) 156. 159 

( CONTROL KX) 62 


diagnostics, built-in [62, 65] 




differences among Apple Ms [61-78] 




disable MouseText 65 




I CONTROL H v | 197 


DISK 221, 222 
disk 




commands 52 




CONTROL RESET 50 


controller cards [74] 


"*§ 


conversion, number |106] 


controller unit See IWM 




COUT 55, 117, 191 


input and output 124-126 


i 


COUT1 55, 68, 117 


I/O firmware entry points 20 


p* 


CP/M [40] 


disk drive 8 




CPU See65C02 


connector 252 


La 


CR See carriage return 


port [50] 




CREF 220. 221. 251 


speed 13 




CROUT 117 


disk-use light 6, [71] 


i 


CROUT1 117 


display 


CSW 56, 70. 104 


address mapping 235-238 




cursor 58, 130, 143. 193 


inverse 191 


■T"~« 


blinking underscore (_) 154 


memory addressing 234 


— 


flashing checkerboard 55 


memory switches 43-47 




flashing question mark 130. 143 


modes 104-108, 239-247 




inverse solid 55 


normal 191 


-i 




page maps 108-114 


L 




pages 102-103 


^ 


Index 


f249~ 



DISVBL 166 

DISXY 166 

DMA transfers 170] 

DOS 126, 130, 143. 179, 180. [39, 69| 

interrupts [42] 

zero page use [16-18] 
double-high-resolution 245 

graphics [74] 

colors 100-101 
drive, external, startup 126 
drive motor 49 
DSR 256, 261, [60] 
DSR1B 257 
DSR2B 257 
DTR 260 
DTR1B 257 
DTR2B 257 
dumb terminal 159 
Dvorak keyboard 6, [88] 
dynamic-RAM refreshment and timing 
226-229 



echo 131, 145. 155. 260 

EIA standard 258 

80 columns 65, 93 

80/40 column switch 5 

80COL 104, 105. 107, 108, 218, 219, 

220 
80STORE 39. 44, 45. 104. 105. 107. 

108. 216, 238, 241 
electrical power 206 
EN80 217 

enable MouseText 65 
ENBVBL 166 
ENBXY 166 
ENCLCRAM 216 
English keyboard [90] 
enhanced video firmware 20, 224 
enter terminal mode 145 
entry points, firmware [31-36] 
environmental specifications 205-206 



ESC ] 4 

IEDCD 

ESC) (¥) 



61 
61 



escape codes 60 
escape sequences 4 
even-parity [114] 
EXAMINE command 190 
examining memory contents 181 
examining registers 190 
expansion ROM space 73 
Extended 80-Column Text Card [64] 
external drive startup 126 
external interrupts [55] 
external power connector 207 
EXTINT 256, [55. 601 



FCC [99] 
firmware 12 

entry points [30-36] 

listings [126-2151 

locations [30-36] 

protocol 71, 134, 148 

video routines 115-123 
flag inputs 21 
FLASH 256 
flashing characters 68 
flashing checkerboard cursor 55 
flashing power light 6 
forced cold start 50 
14M 215. 220, 221 
FORTRAN [41] 
40 columns, switching to 80 5 
40-column 65, 93 
48K memory 34. 35. 39 
framing errors 258 
French keyboard [91-92] 
full duplex 156-158 



1 

b-« 

*2 



250 



Index 



GAME I/O connector |76| 

game input 267 

game paddles See hand controls 

GAMESWO 268 

GAMESW1 268 

General Logic Unit (GLU) 13 

German keyboard [93] 

GETLN 58-62, 180 

GETLN1 59, 82 

GETLNZ 82 

GLU 221 

GND 257 

GO command 189, 190, 192, 198 

graphic bits [109] 

graphics mode 96-102 

greater than sign (>) 59 

H 

half duplex 155 

hand control 8, 173-178 

circuits 269 

connector 174 

input [76) 

signals 270 
hand controller 267 
handle 9, 206 
hardware 

accesses 21 

addresses [66] 

locations 181, [15] 

page locations 164 
headphones 232 
heat 206 
hexadecimal [106] 

arithmetic 193 



high-resolution 97 

colors 243 

display 243 

double 245 

graphics colors 98-99 

Page 1 37 

Page 2 38 
HIRES 44,45, 104, 105, 107. 216, 

218,[67] 
HLINE 117 
HOME 118 
HOMEMOUSE 168 
HRP1 37 
HRP1X 37,45 
HRP2 45 
HRP2X 38 
humidity 205 

/ 

I command 131, 145, 158 

I/O firmware, video routines 120-123 

I/O links 55 

icons 68 

identification bytes 71 

IEC [99] 

IN#2 143, 154 

IN#n 56. 70 

index registers 17 

INH 217 

INITMOUSE 169 

input and output, disk 124-126 

input buffer (page $02) 36 

Input/Output Unit (IOU) 13.215, 

218-219, [78] 
instruction cycle times [63] 
Integer BASIC 59,(16-18.41.69] 
Integrated Woz Machine (IWM) 13 
internal converter 208 
internal voltage converter 206 



Index 



251 



interrupt(s) 24. 75, 260, [40-60, 70] 

ACIA [49] 

Apple II and [42] 

Apple II Plus and [42] 

Apple lie and |43] 

disk drive port [49] 

DOS and [42] 

keyboard [52-53] 

Monitor and [42] 

mouse [49] 

Pascal and [42] 

65C02 and [43) 

6551 [49] 

vertical blanking [49] 
interrupt handler(s) 

mouse 163 

user's [57] 
interrupt requests 52 
interrupt vector [43-44] 
interrupt-handling sequence [45] 
inverse 65 

characters 68 

display 191 

solid cursor 55 
INVERSE command 191 
invoking the monitor 179 
IOREST [36] 
IORTS [36] 
IOSAVE [36] 
IOU (Input/Output Unit) 13,215. 

218-219. [78] 
IOUDIS 49, 104. 106. 166. [67, 68| 
IOUSELIO 219 
IRQ 75, 156, 219, [43] 

handling routine [34] 

vector [36| 
ISO [84] 

layout [89] 
Italian keyboard [94| 
IWM (Integrated Woz Machine) 13. 
222 



jack 7 

JMP $C600 126 

JMP indirect instruction [3] 

joysticks See hand controls 



K (1024) 17 
K command 131. 145 
KBD 217 
keyboard 229-231 
buffer [52-53] 
character decoder 225 
circuit diagram 230 
data [66] 
input buffer 37 
interrupts [52. 53] 
layout [71] 
ANSI [90] 
British See English 
Canadian [91-92] 
Dvorak [88] 
English [90] 
French [91-92] 
German [93J 
ISO [90] 
Italian [94-95] 
Sholes [851 
Western Spanish [96] 
signals 231 

strobe 79, 229. [50. 66] 
switch 5 
standard 5 
KEYIN 55, 57. 58 
KSTRB 77, 219, 256 
KSW 56, 57, 70, 104 



L command 131. 145 
LANGSW 256 
LDPS 220, 241, 251 






252 



Index 



E 


line feed 145, 152 


monitor 8, 24. 59, 179-203, 224 






w 


automatic 131 


entry point [36] 






E 


line length 136, 150 
line voltage 205 
line width 139, 144 
LIST command 199 


interrupts and [42] 
output 248 

register commands 189-190 
ROM [69] 






E 


local 154 
low-resolution 
colors 242 


video routines 115 
zero page use [15] 
mouse 8, 160-174, [49-50] 






E 


display 242 
graphics 96 


BASIC and 163, 172 
Pascal and 171 
button 171 






E 


M 

machine identification [63] 


interrupt mode 164 
signals 266 
clamping boundaries 171 






E 


main memory screen holes 135-136, 

149, 150 
main RAM 20 


connector 264 
direction [59] 
firmware 167 








MARK (1) 132 

MARK parity 138, [114] 

master clock 213 


firmware entry points 20 
hardware locations 164-167 
input 262, [76] 






p 


maximum current drain 252 
memory 


interrupt handler 165 
interrupts [58] 






^ 


addressing 223-229 


movement interrupt mode 163 






E 


bank-switched 22 
bus organization 224 
comparing data in 188-189 


operating modes 163 
port 161-174 
transparent mode 163 






E 


display switches 43-47 
dump 182-184 
examining contents 181 


waveform 263 
X direction 167 
Y direction 167 






p 


48K 34 

map 18, [15-28] 


MOUSEID 264 

MouseText 65, 68-69. 90-91. [73, 114] 






E 


moving data in 186-188 
organization [64] 
state [48] 
switches, display 43-47 


MOUX1 167 

MOUY1 167 

MOVE command 186-188, 195, [36] 

MOVEAUX 41-42 






B 


Memory Management Unit See MMU 
microprocessor, 65C02 12, 15 


movement/button interrupt mode 164, 
167 






fc^i 


mini-phone jack 7 


movement interrupt mode 163, 167 






■j" 


MIXED 105, 107, 218, [67] 
mixed-modes displays 102 


moving data in memory 186-188 
MSLOT [21] 
MSW 264 






^trvj 


MMU 13, 215-217, 267, 271, [78] 






to 


mnemonic 199 








■ 


modem 8, 151 








r 


modes, display 239-247 








r 


Index 


1 253 







N 

N command 131, 145. 156 

n CONTROL-K 56 

NE556 265, 271, [77] 

negative decimal (107] 

NEWIRQ [34] 

nibble |104] 

NMI vector [36, 43] 

non-maskable interrupts 52 

NORMAL command 191 

normal characters 65, 68 

normal display 191 

NTSC 87, 233, 242, 248, 251 

#6 130 

#7 143 

#8 143 



odd-parity (114] 

old monitor ROM [62] 

1 CONTROL-P 130 

1VSOUND 251 

@D 4,82 

operand 199 

operating systems (39-40] 

operating temperature 205 

output and input, disk 124-126 

output jack 232 



P command 132, 145 
P register 17 
paddle(s) 267 

button 268 

button 1 268 

inputs (68, 76] 

timing circuit [77] 
page 18 

page $02 (input buffer) 36 
page $03 36 
page $04 36 
page $08 37 



page 18 

page zero 24 

page 1 18 

PAGE2 44-45, 105, 107-108. 216. 

238. 241, (46-48, 67] 
page three [19] 
page 8, auxiliary RAM (52] 
PAL 233 
parity 145 

bit(s) 138, 262 

checking 260 
Pascal 67, 126, 130. 134, 170. [114] 

ID byte 134, 148 

interrupts and [42] 

language [41] 

operating system [40| 
PC (program counter) 16 
PCAS 220 
PDL0 176 
PDL0/XMOVE 219 
PDL1 176 
PEEK [40] 

peripheral identification numbers [112] 
peripheral-card memory space |65-66] 
peripheral-card ROM space [65] 
phone jack 7 
PIN numbers [112] 
PINIT 72, 121, 134, 148 
PLOT 118 
plotter 8 
POKE [40] 
ports 70, [70] 
POSMOUSE 168 
power 8 

connector 207 

consumption 207, 208 

light 6, [71] 

requirements 206 

supply [100] 
power-on light [71] 
power-up byte 51 



254 



Index 



L 






4 








PR#1 130 


random number 58 


PR#2 143. 154 


random-access memory (RAM) 17 


PR#6 126 


RAS (row-address strobe) 228 


1 


PR#n 56, 70 


RD1B 257 


■ - 


PRAS 217, 219. 220, 251 


RD63 167 


»~X 


PRBL2 118 


RD80COL 105 


1 


PRBYTE 118 


RD80STORE 105 


PREAD 72, 121. 134, 148. 177 


RDALTCHAR 105 


PRERR 118 


RDALTZP 26 


1 


PRHEX 118 


RDBNK2 26 


primary character set 68. [73| 


RDCHAR 82 


M 


printer 8 


RDCRAM [46| 


1 


PRINTER: 130 


RDDHIRES 106 


processor status register 17 


RDHIRES 45, 105 


■»4 


ProDOS 126, 130, 143, 180, [39, 63| 


RDIOUDIS 106. 166 


I 


program counter (PC) 16, 201 


RDKEY 55, 57 


prompt 58, 154 


RDLCRAM 26 


M 


characters 59 


RDMIXED 105 


l , 


PRTAX 118 


RDPAGE2 105 


PSTATUS 72. 123, 134, 148 


RDRAMRD 39 


M 


PTRIG 166 


RDRAMWRT 39 


■ 


published entry points [32-36] 


RDTEXT 105 


1 


pull from stack 1 7 


RDTNO 167 


M 


push onto stack 1 7 


RDVBLMSK 166 


1 


PWRITE 72. 121, 134, 148 


RDXYMSK 166 




RDYOEDGE 166 


i J 


Q 


read-only memory (ROM) 17 
READMOUSE 163, 168. [51-52] 


1 


Q command 145 


receive register 262 


" u 


Q3 215,217, 219 


registers 15. 213 


1^ 


question mark (?) 58. 59 


examining 190 


L 


quit terminal mode 145 


relative humidity 205 


fcs 




REMIN 143 


i 


R 


remote 154, 159 


R command 132 


remote device 145 


Z E 


R/W 217, 219, 221, 257 


REMOUT 143 


1 


RA0-RA7 217 
RAM 17 


(REPTjkey [71] 

Request to Send See RTS 


i 4 


addressing 226-229 


(reset) key 4, 79, 82, 221, 113. 256. 
[71| 


i 


locations [15) 


L 


RAMRD 38. 39, 43. 44. 216, |46| 


reset port 1 132 


RAMWRT 38. 39, 43. 44, 216. [46] 


reset port 2 145 


, 




reset routine 48 


L 




reset vector 49-51, [36] 


i 


(RETURN) [84 1 


h 


Index 


1 255 



retype 62 

RF modulator 233 

RGB monitor 245 

rollover 3 

ROM 17 

ROM addressing 224-225 

ROMEN2 217 

RS-232 129 

RSTVBL 166 

RSTXINT 166. 216 

RSTXY 166 

RSTYINT 166, 216 

RTS instruction 260, |36l 



S command 132 
S register 17 

safety instructions 207, [99] 
schematic diagrams 271-276 
scratch-pad RAM [65] 
screen holes 36, 73, 74. 133. 134. 
136, 149, 171-173, (20-22, 47] 
SCRN 119 
scroll 65 
SEGA 218 
SEGB 218, 220, 251 
self-tests See diagnostics, built-in 
SER 221, 256 
serial buffering [55] 
serial data transfer [57] 
serial firmware (50] 
serial I/O buffers [75] 
serial I/O port 128-159 
serial input buffer 37 
Serial Interface Card (74] 
serial interrupts [55, 56] 
serial port circuits 254 
serial port 1 20, 129-139 



serial port 2 20, 141-159 

command character 143, 146 

command character hardware 
locations 130, 132, 134 

firmware protocol 147 

hardware locations 148 

initial characteristics 130, 147 
SEROUT 251 

SERVEMOUSE 163, 168. [51] 
SETCOL 119 

SETMOUSE 167-168. [50-51] 
SETPWRC 51 
7M 220, 223 
(shift) key 79, 229. |84] 
shift-key mod [68] 
Sholes keyboard 5 
signature byte 134, 148, 170 
simplified keyboard (Dvorak) [88] 
© 126 
65C02 12, 15, [63] 

address bus 213 

addressing modes 

block diagram 211 

clock 211 

cycle time [1, 2] 

data bus 213 

data sheet [5-13] 

differences from 6502 
[1-3, 6-7] 

execution time 

instruction set 

opcodes [12] 

registers 213 

signal descriptions 

timing diagram [8] 

timing signals 214-215 
6502 verus 65C02 211 
6551 Asynchronous Communication 
Interface Adapters See ACIA 
slot 7 drive 1 [74] 
SLOTC3ROM [66] 
SLOTCXROM [66] 



[10] 



211. 



[1-2] 
[12-13] 



[111 



W* 



256 



Index 



slots 70 

versus ports [70] 
soft switches 22, 215, 218, 221 
GD 82 

SPACE (0) 132 
SPACE parity 138, [114] 
speaker 83-84, [67) 

external 7 

output jack 232 

volume control 232 
SPKR 219 
stack 24, [42, 46] 
stack pointer 17 
standard I/O links 55 
standard keyboard 5 
start bit 137 

status register 134, 148, 261 
stop bits 137 
stop-list 65 
STORE command 194 
strobe 79 

inputs 21 
SUD See System Utilities Disk 
Super Serial Cards [74] 
SWO 175 
SW1 175 

switch inputs 175, [76] 
switches, soft 22, 215 
SYNC 219, 233, 251 
system clock 213 
system monitor 179-203 
System Utilities Disk 129, 131, 136, 
141, 145, 150, [75, 112] 



145, 154-156. 159 



T command 
QaD [84] 
TD1B 257 
telephone jack 7 
temperature 205, 208 



terminal mode 145, [53] 

TEXT 105. 107, 218, 220, 221, 251, 

[67] 
text 

and low-resolution graphics Page 1 
36 

and low-resolution Page 1X 36 

and screen low-resolution Page 2 
37 

displays 241 

modes 90-95 

window 63, 66 
TLP1 36 
TLP1X 36. 45 
TLP2X 37 
toggle switches 22 
transferring control 42-43 
transferring data 41-42 
transmit/receive data register 134, 

148 
transmit register 262 
transparent mode 163, 167, 171 
triggering paddle timers [68] 

U 

USA standard keyboard 5 
USER command 197 
user's interrupt handler [57] 
utility strobe [67] 



validity check 49 
VBL [67, 73, 76] 
VBLINT 163. 164, 218. [67, 73] 
VDE [99] 
vectors 55 
ventilation 206 

VERIFY command 188, 196, [36] 
vertical blanking 163, [49, 50, 73] 
interrupts [68] 



Index 



257 



VID 248 
VID7M 215. 220 
video 

counters 233-234 

display 225 

display circuits 240 

display modes 239-247 

expansion 8 

expansion connector 249-252 

expansion output 249 

output signals 248 

routines 
firmare 115-123 
I/O firmware 120-123 
monitor 115-119 
VLINE 119 
voltage 205 

converter 10 
volume control 7, 232 



Y register 17 
Y0 218.262,264 
Y1 263, 264 
YINT 164. [66. 67] 
YMOVE 219 
YOEDGE 166 



Z command 132. 139 
zap 132. 139, 145 
zero page 24, 184 



W 

WAIT (36) 

warm-start procedure 50 

Western Spanish keyboard |96] 

WNDW 219. 233. 251 

word 1 106] 

Woz Integrated Machine 13,222 



X register 17 

X0 215.218.262,264 

XI 215. 263, 264 
XFER 41. 42 
XINT 164, |66, 67] 
XOEDGE 166 



258 



Index 






•-4 



LZ 

E